3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Singleton { private $storage; // A Temporary variable for 'quick data' protected $methods = array(); // Anonymous Function Declaration protected static $getInstance; // Instance of the Container public static function __callStatic($methodName, $arguments = array()) { return self::getInstance()->Skeleton( $methodName, $arguments ); } public static function newInstance() { // Start a new instance of the class and pass any arguments $class = new \ReflectionClass( get_called_class() ); self::$getInstance = $class->newInstanceArgs( func_get_args() ); return self::$getInstance; } public static function getInstance() { // see if the class has already been called this run if (!empty(self::$getInstance)) return self::$getInstance; $calledClass = get_called_class(); // check if the object has been sterilized in the session // This will invoke the __wake up operator if (isset($_SESSION) && array_key_exists( $calledClass, $_SESSION ) && is_object( self::$getInstance = unserialize( $_SESSION[$calledClass] ))) return self::$getInstance; // Start a new instance of the class and pass any arguments $class = new \ReflectionClass( get_called_class() ); self::$getInstance = $class->newInstanceArgs( func_get_args() ); return self::$getInstance; } /** * @param null $object * @return object|null */ public static function clearInstance($object = null) { self::$getInstance = is_object( $object ) ? $object : null; if (array_key_exists( __CLASS__, $_SESSION )) unset($_SESSION[__CLASS__]); return self::$getInstance; } public function __call($methodName, $arguments = array()) { return $this->Skeleton( $methodName, $arguments ); } private function Skeleton($methodName, $arguments = array()) { // Have we used addMethod() to override an existing method if (key_exists( $methodName, $this->methods )) return (null === ($result = call_user_func_array( $this->methods[$methodName], $arguments )) ? $this : $result); // Is the method in the current scope ( public, protected, private ). // Note declaring the method as private is the only way to ensure single instancing if (method_exists( $this, $methodName )) { return (null === ($result = call_user_func_array( array($this, $methodName), $arguments )) ? $this : $result); } if (key_exists( 'closures', $GLOBALS ) && key_exists( $methodName, $GLOBALS['closures'] )) { $function = $GLOBALS['closures'][$methodName]; $this->addMethod( $methodName, $function ); return (null === ($result = call_user_func_array( $this->methods[$methodName], $arguments )) ? $this : $result); } throw new \Exception( "There is valid method or closure with the given name '$methodName' to call" ); } private function addMethod($name, $closure) { if (is_callable( $closure )): $this->methods[$name] = \Closure::bind( $closure, $this, get_called_class() ); else: // Nested to ensure Singleton returns the correct value of self throw new \Exception( "New Method Must Be A Valid Closure" ); endif; } public function __wakeup() { if (method_exists( $this, '__construct' )) self::__construct(); $object = get_object_vars( $this ); foreach ($object as $item => $value) // TODO - were really going to try and objectify everything? if(is_object( $temp = @unserialize($this->$item))) $this->$item = $temp; } // for auto class serialization add: const Singleton = true; to calling class public function __sleep() { if (!defined( 'self::Singleton' ) || !self::Singleton) return null; $object = get_object_vars( $this ); foreach ($object as $key => &$value) { if (empty($value) || empty($this->$key)) continue; // The object could be null from serialization? if (is_object( $value )) { try { $this->$key = @serialize( $value ); } catch (\Exception $e){ continue; } // Database object we need to catch the error thrown. if ($_SESSION[__CLASS__][0] != 'O') continue; } $onlyKeys[] = $key; } return (isset($onlyKeys) ? $onlyKeys : null); } public function __destruct() { // We require a sleep function to be set manually for singleton to manage utilization if (!defined( 'self::Singleton' ) || !self::Singleton) return null; try { $_SESSION[__CLASS__] = @serialize( $this ); // I was using if (__sleep != null).. but resulted in errors, this is a shitty fix ill admit } catch (\Exception $e){ unset($_SESSION[__CLASS__]); return null; }; if ($_SESSION[__CLASS__][0] != 'O') unset($_SESSION[__CLASS__]); // We only want to store objects, if } // The rest of the methods are for the sake of methods public function &__get($variable) { return $GLOBALS[$variable]; } public function __set($variable, $value) { $GLOBALS[$variable] = $value; } public function __isset($variable) { return array_key_exists( $variable, $GLOBALS ); } public function __unset($variable) { unset($GLOBALS[$variable]); } public function __invoke() { return $this->storage; } private function set($name, $value = null) { $this->storage = null; if ($value == null) { if (is_array( $name )) $this->storage = $name; else $this->storage[] = $name; } else $this->storage[$name] = $value; return $this; } private function get($variable = null) { return ($variable == null ? $this->storage : $this->{$variable}); } private function has($variable) { return isset($this->$variable); } } class stdOJB implements \ArrayAccess { use Singleton; const Singleton = true; // turns on auto caching public function __construct() { return null; } public function offsetSet($offset, $value) { if (is_null($offset)) $this->storage[] = $value; else $this->storage[$offset] = $value; } public function offsetExists($offset) { return isset($this->storage[$offset]); } public function offsetUnset($offset) { unset($this->storage[$offset]); } public function offsetGet($offset) { return isset($this->storage[$offset]) ? $this->storage[$offset] : null; } public function &__get($variable) { return $this->storage[$variable]; } public function __set($variable, $value) { $this->storage[$variable] = $value; } public function __isset($variable) { return array_key_exists( $variable, $this->storage ); } public function __unset($variable) { unset($this->storage[$variable]); } public function __destruct() { return null; } } abstract class QuickFetch { protected $db; public function fetch_into_current_class($array) { $object = get_object_vars( $this ); foreach ($array as $key => $value) if (array_key_exists( $key, $object )) $this->$key = $value; } public function fetch_as_object($sql,... $execute) { try { $stmt = $this->db->prepare( $sql ); $stmt->setFetchMode( \PDO::FETCH_CLASS, Skeleton::class ); $stmt->execute( $execute ); $stmt = $stmt->fetchAll(); // user obj return (is_array( $stmt ) && count( $stmt ) == 1 ? array_pop( $stmt ) : $stmt); } catch (\Exception $e) { sortDump( $e ); } } } class user extends QuickFetch { use Singleton; const Singleton = true; public $info; private function getPublicData() { echo "here"; return null; if (!empty($this->courseId) && (!is_object( $this->course ) || $this->course->course_id != $this->courseI)) $this->course = (object) ['course_id' => 3]; // $this->fetch_as_object( $sql, $id ); echo $this->course; exit(1); if (!empty($this->boxColor)) { if (!is_object( $this->course )) throw new \Error(); // $this->course->distance = $this->fetch_as_object( 'SELECT * FROM StatsCoach.golf_distance WHERE course_id = ? AND distance_color = ?', $this->courseId, $this->boxColor ); if (!isset($this->course->distance) || !is_object( $this->course->distance ) || $this->course->distance->distance_color != $this->boxColor) { $this->course->distance = $this->fetch_as_object( 'SELECT * FROM StatsCoach.golf_distance WHERE course_id = ? AND distance_color = ?', $this->courseId, $this->boxColor ); return null; } if (!is_object( $this->course->distance )) throw new \Exception(); return null; } } } user::getPublicData();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G54Fc
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  161     0  E >   DECLARE_CLASS                                            'stdojb'
  240     1        DECLARE_CLASS                                            'user', 'quickfetch'
  270     2        INIT_STATIC_METHOD_CALL                                  'user', 'getPublicData'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Class Singleton:
Function __callstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G54Fc
function name:  __callStatic
number of ops:  10
compiled vars:  !0 = $methodName, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
   11     2        INIT_STATIC_METHOD_CALL                                  'getInstance'
          3        DO_FCALL                                      0  $2      
          4        INIT_METHOD_CALL                                         $2, 'Skeleton'
          5        SEND_VAR_EX                                              !0
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0  $3      
          8      > RETURN                                                   $3
   12     9*     > RETURN                                                   null

End of function __callstatic

Function newinstance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G54Fc
function name:  newInstance
number of ops:  14
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'ReflectionClass'
          1        GET_CALLED_CLASS                                 ~2      
          2        SEND_VAL_EX                                              ~2
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   17     5        INIT_METHOD_CALL                                         !0, 'newInstanceArgs'
          6        FUNC_GET_ARGS                                    ~6      
          7        SEND_VAL_EX                                              ~6
          8        DO_FCALL                                      0  $7      
          9        ASSIGN_STATIC_PROP                                       'getInstance'
         10        OP_DATA                                                  $7
   18    11        FETCH_STATIC_PROP_R          unknown             ~8      'getInstance'
         12      > RETURN                                                   ~8
   19    13*     > RETURN                                                   null

End of function newinstance

Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
Branch analysis from position: 12
filename:       /in/G54Fc
function name:  getInstance
number of ops:  39
compiled vars:  !0 = $calledClass, !1 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ISSET_ISEMPTY_STATIC_PROP                        ~2      'getInstance'
          1        BOOL_NOT                                         ~3      ~2
          2      > JMPZ                                                     ~3, ->5
   24     3    >   FETCH_STATIC_PROP_R          unknown             ~4      'getInstance'
          4      > RETURN                                                   ~4
   25     5    >   GET_CALLED_CLASS                                 ~5      
          6        ASSIGN                                                   !0, ~5
   28     7        ISSET_ISEMPTY_VAR                             2  ~7      '_SESSION'
          8      > JMPZ_EX                                          ~7      ~7, ->12
          9    >   FETCH_R                      global              ~8      '_SESSION'
         10        ARRAY_KEY_EXISTS                                 ~9      !0, ~8
         11        BOOL                                             ~7      ~9
         12    > > JMPZ_EX                                          ~7      ~7, ->22
   29    13    >   INIT_FCALL                                               'unserialize'
         14        FETCH_R                      global              ~11     '_SESSION'
         15        FETCH_DIM_R                                      ~12     ~11, !0
         16        SEND_VAL                                                 ~12
         17        DO_ICALL                                         $13     
         18        ASSIGN_STATIC_PROP                               ~10     'getInstance'
         19        OP_DATA                                                  $13
         20        TYPE_CHECK                                  256  ~14     ~10
         21        BOOL                                             ~7      ~14
         22    > > JMPZ                                                     ~7, ->25
   30    23    >   FETCH_STATIC_PROP_R          unknown             ~15     'getInstance'
         24      > RETURN                                                   ~15
   32    25    >   NEW                                              $16     'ReflectionClass'
         26        GET_CALLED_CLASS                                 ~17     
         27        SEND_VAL_EX                                              ~17
         28        DO_FCALL                                      0          
         29        ASSIGN                                                   !1, $16
   33    30        INIT_METHOD_CALL                                         !1, 'newInstanceArgs'
         31        FUNC_GET_ARGS                                    ~21     
         32        SEND_VAL_EX                                              ~21
         33        DO_FCALL                                      0  $22     
         34        ASSIGN_STATIC_PROP                                       'getInstance'
         35        OP_DATA                                                  $22
   34    36        FETCH_STATIC_PROP_R          unknown             ~23     'getInstance'
         37      > RETURN                                                   ~23
   35    38*     > RETURN                                                   null

End of function getinstance

Function clearinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
Branch analysis from position: 15
filename:       /in/G54Fc
function name:  clearInstance
number of ops:  18
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV_INIT                                        !0      null
   43     1        TYPE_CHECK                                  256          !0
          2      > JMPZ                                                     ~2, ->5
          3    >   QM_ASSIGN                                        ~3      !0
          4      > JMP                                                      ->6
          5    >   QM_ASSIGN                                        ~3      null
          6    >   ASSIGN_STATIC_PROP                                       'getInstance'
          7        OP_DATA                                                  ~3
   44     8        FETCH_CLASS_NAME                                 ~4      
          9        FETCH_R                      global              ~5      '_SESSION'
         10        ARRAY_KEY_EXISTS                                         ~4, ~5
         11      > JMPZ                                                     ~6, ->15
         12    >   FETCH_CLASS_NAME                                 ~8      
         13        FETCH_UNSET                                      $7      '_SESSION'
         14        UNSET_DIM                                                $7, ~8
   45    15    >   FETCH_STATIC_PROP_R          unknown             ~9      'getInstance'
         16      > RETURN                                                   ~9
   46    17*     > RETURN                                                   null

End of function clearinstance

Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G54Fc
function name:  __call
number of ops:  8
compiled vars:  !0 = $methodName, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
   50     2        INIT_METHOD_CALL                                         'Skeleton'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0  $2      
          6      > RETURN                                                   $2
   51     7*     > RETURN                                                   null

End of function __call

Function skeleton:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 22
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 43
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 41
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
2 jumps found. (Code = 46) Position 1 = 49, Position 2 = 56
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 79
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 74, Position 2 = 77
Branch analysis from position: 74
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 77
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 79
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 56
filename:       /in/G54Fc
function name:  Skeleton
number of ops:  87
compiled vars:  !0 = $methodName, !1 = $arguments, !2 = $result, !3 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
   56     2        INIT_FCALL                                               'key_exists'
          3        SEND_VAR                                                 !0
          4        FETCH_OBJ_R                                      ~4      'methods'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                         $5      
          7      > JMPZ                                                     $5, ->22
   57     8    >   FETCH_OBJ_R                                      ~6      'methods'
          9        FETCH_DIM_R                                      ~7      ~6, !0
         10        INIT_USER_CALL                                0          'call_user_func_array', ~7
         11        SEND_ARRAY                                               !1
         12        CHECK_UNDEF_ARGS                                         
         13        DO_FCALL                                      0  $8      
         14        ASSIGN                                           ~9      !2, $8
         15        TYPE_CHECK                                    2          ~9
         16      > JMPZ                                                     ~10, ->20
         17    >   FETCH_THIS                                       ~11     
         18        QM_ASSIGN                                        ~12     ~11
         19      > JMP                                                      ->21
         20    >   QM_ASSIGN                                        ~12     !2
         21    > > RETURN                                                   ~12
   60    22    >   INIT_FCALL                                               'method_exists'
         23        FETCH_THIS                                       ~13     
         24        SEND_VAL                                                 ~13
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                         $14     
         27      > JMPZ                                                     $14, ->43
   61    28    >   FETCH_THIS                                       ~15     
         29        INIT_ARRAY                                       ~16     ~15
         30        ADD_ARRAY_ELEMENT                                ~16     !0
         31        INIT_USER_CALL                                0          'call_user_func_array', ~16
         32        SEND_ARRAY                                               !1
         33        CHECK_UNDEF_ARGS                                         
         34        DO_FCALL                                      0  $17     
         35        ASSIGN                                           ~18     !2, $17
         36        TYPE_CHECK                                    2          ~18
         37      > JMPZ                                                     ~19, ->41
         38    >   FETCH_THIS                                       ~20     
         39        QM_ASSIGN                                        ~21     ~20
         40      > JMP                                                      ->42
         41    >   QM_ASSIGN                                        ~21     !2
         42    > > RETURN                                                   ~21
   63    43    >   INIT_FCALL                                               'key_exists'
         44        SEND_VAL                                                 'closures'
         45        FETCH_R                      global              ~22     'GLOBALS'
         46        SEND_VAL                                                 ~22
         47        DO_ICALL                                         $23     
         48      > JMPZ_EX                                          ~24     $23, ->56
         49    >   INIT_FCALL                                               'key_exists'
         50        SEND_VAR                                                 !0
         51        FETCH_R                      global              ~25     'GLOBALS'
         52        FETCH_DIM_R                                      ~26     ~25, 'closures'
         53        SEND_VAL                                                 ~26
         54        DO_ICALL                                         $27     
         55        BOOL                                             ~24     $27
         56    > > JMPZ                                                     ~24, ->79
   64    57    >   FETCH_R                      global              ~28     'GLOBALS'
         58        FETCH_DIM_R                                      ~29     ~28, 'closures'
         59        FETCH_DIM_R                                      ~30     ~29, !0
         60        ASSIGN                                                   !3, ~30
   65    61        INIT_METHOD_CALL                                         'addMethod'
         62        SEND_VAR_EX                                              !0
         63        SEND_VAR_EX                                              !3
         64        DO_FCALL                                      0          
   66    65        FETCH_OBJ_R                                      ~33     'methods'
         66        FETCH_DIM_R                                      ~34     ~33, !0
         67        INIT_USER_CALL                                0          'call_user_func_array', ~34
         68        SEND_ARRAY                                               !1
         69        CHECK_UNDEF_ARGS                                         
         70        DO_FCALL                                      0  $35     
         71        ASSIGN                                           ~36     !2, $35
         72        TYPE_CHECK                                    2          ~36
         73      > JMPZ                                                     ~37, ->77
         74    >   FETCH_THIS                                       ~38     
         75        QM_ASSIGN                                        ~39     ~38
         76      > JMP                                                      ->78
         77    >   QM_ASSIGN                                        ~39     !2
         78    > > RETURN                                                   ~39
   67    79    >   NEW                                              $40     'Exception'
         80        ROPE_INIT                                     3  ~42     'There+is+valid+method+or+closure+with+the+given+name+%27'
         81        ROPE_ADD                                      1  ~42     ~42, !0
         82        ROPE_END                                      2  ~41     ~42, '%27+to+call'
         83        SEND_VAL_EX                                              ~41
         84        DO_FCALL                                      0          
         85      > THROW                                         0          $40
   68    86*     > RETURN                                                   null

End of function skeleton

Function addmethod:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/G54Fc
function name:  addMethod
number of ops:  22
compiled vars:  !0 = $name, !1 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   70     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   72     2        INIT_FCALL                                               'is_callable'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $2      
          5      > JMPZ                                                     $2, ->17
   73     6    >   INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          7        SEND_VAR                                                 !1
          8        FETCH_THIS                                       ~5      
          9        SEND_VAL                                                 ~5
         10        GET_CALLED_CLASS                                 ~6      
         11        SEND_VAL                                                 ~6
         12        DO_FCALL                                      0  $7      
         13        FETCH_OBJ_W                                      $3      'methods'
         14        ASSIGN_DIM                                               $3, !0
         15        OP_DATA                                                  $7
         16      > JMP                                                      ->21
   75    17    >   NEW                                              $8      'Exception'
         18        SEND_VAL_EX                                              'New+Method+Must+Be+A+Valid+Closure'
         19        DO_FCALL                                      0          
         20      > THROW                                         0          $8
   77    21    > > RETURN                                                   null

End of function addmethod

Function __wakeup:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 28
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 28
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 27
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 8
filename:       /in/G54Fc
function name:  __wakeup
number of ops:  30
compiled vars:  !0 = $object, !1 = $value, !2 = $item, !3 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   81     0  E >   INIT_FCALL                                               'method_exists'
          1        FETCH_THIS                                       ~4      
          2        SEND_VAL                                                 ~4
          3        SEND_VAL                                                 '__construct'
          4        DO_ICALL                                         $5      
          5      > JMPZ                                                     $5, ->8
          6    >   INIT_STATIC_METHOD_CALL                                  
          7        DO_FCALL                                      0          
   82     8    >   INIT_FCALL                                               'get_object_vars'
          9        FETCH_THIS                                       ~7      
         10        SEND_VAL                                                 ~7
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !0, $8
   83    13      > FE_RESET_R                                       $10     !0, ->28
         14    > > FE_FETCH_R                                       ~11     $10, !1, ->28
         15    >   ASSIGN                                                   !2, ~11
   84    16        BEGIN_SILENCE                                    ~13     
         17        INIT_FCALL                                               'unserialize'
         18        FETCH_OBJ_R                                      ~14     !2
         19        SEND_VAL                                                 ~14
         20        DO_ICALL                                         $15     
         21        END_SILENCE                                              ~13
         22        ASSIGN                                           ~16     !3, $15
         23        TYPE_CHECK                                  256          ~16
         24      > JMPZ                                                     ~17, ->27
   85    25    >   ASSIGN_OBJ                                               !2
         26        OP_DATA                                                  !3
   83    27    > > JMP                                                      ->14
         28    >   FE_FREE                                                  $10
   86    29      > RETURN                                                   null

End of function __wakeup

Function __sleep:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 125) Position 1 = 16, Position 2 = 46
Branch analysis from position: 16
2 jumps found. (Code = 126) Position 1 = 17, Position 2 = 46
Branch analysis from position: 17
2 jumps found. (Code = 47) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 43
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 43
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 43
Branch analysis from position: 22
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 51
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
Branch analysis from position: 8
Found catch point at position: 34
Branch analysis from position: 34
2 jumps found. (Code = 107) Position 1 = 35, Position 2 = -2
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
filename:       /in/G54Fc
function name:  __sleep
number of ops:  54
compiled vars:  !0 = $object, !1 = $value, !2 = $key, !3 = $e, !4 = $onlyKeys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   91     0  E >   INIT_FCALL                                               'defined'
          1        SEND_VAL                                                 'self%3A%3ASingleton'
          2        DO_ICALL                                         $5      
          3        BOOL_NOT                                         ~6      $5
          4      > JMPNZ_EX                                         ~6      ~6, ->8
          5    >   FETCH_CLASS_CONSTANT                             ~7      'Singleton'
          6        BOOL_NOT                                         ~8      ~7
          7        BOOL                                             ~6      ~8
          8    > > JMPZ                                                     ~6, ->10
          9    > > RETURN                                                   null
   92    10    >   INIT_FCALL                                               'get_object_vars'
         11        FETCH_THIS                                       ~9      
         12        SEND_VAL                                                 ~9
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !0, $10
   93    15      > FE_RESET_RW                                      $12     !0, ->46
         16    > > FE_FETCH_RW                                      ~13     $12, !1, ->46
         17    >   ASSIGN                                                   !2, ~13
   94    18        ISSET_ISEMPTY_CV                                 ~15     !1
         19      > JMPNZ_EX                                         ~15     ~15, ->22
         20    >   ISSET_ISEMPTY_PROP_OBJ                           ~16     !2
         21        BOOL                                             ~15     ~16
         22    > > JMPZ                                                     ~15, ->24
         23    > > JMP                                                      ->16
   95    24    >   TYPE_CHECK                                  256          !1
         25      > JMPZ                                                     ~17, ->43
   96    26    >   BEGIN_SILENCE                                    ~19     
         27        INIT_FCALL                                               'serialize'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                         $20     
         30        END_SILENCE                                              ~19
         31        ASSIGN_OBJ                                               !2
         32        OP_DATA                                                  $20
         33      > JMP                                                      ->36
   97    34  E > > CATCH                                       last         'Exception'
         35    > > JMP                                                      ->16
   98    36    >   FETCH_CLASS_NAME                                 ~22     
         37        FETCH_R                      global              ~21     '_SESSION'
         38        FETCH_DIM_R                                      ~23     ~21, ~22
         39        FETCH_DIM_R                                      ~24     ~23, 0
         40        IS_NOT_EQUAL                                             ~24, 'O'
         41      > JMPZ                                                     ~25, ->43
         42    > > JMP                                                      ->16
   99    43    >   ASSIGN_DIM                                               !4
         44        OP_DATA                                                  !2
   93    45      > JMP                                                      ->16
         46    >   FE_FREE                                                  $12
  100    47        ISSET_ISEMPTY_CV                                         !4
         48      > JMPZ                                                     ~27, ->51
         49    >   QM_ASSIGN           

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
267.06 ms | 1428 KiB | 28 Q