3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $key; public $link; function __destruct() { global $flag; global $permit; if($permit==1) echo $flag; } function __wakeup() { exit("nonono"); } } class B { public $key; public $link; function __destruct() { global $file; global $flag; $flag="get_flag_contents"; } function __wakeup() { global $file; $this->key=1; $file='index.php'; } function __toString() { if($link->key==0){ global $file; $file='flag.php'; return "WOW!!!"; } } } class C { public $key; public $link; function __destruct() { if($this->link->key==1) echo $this->link; } function __wakeup() { exit("nonono"); } } class D { public $key; public $link; function __destruct() { global $permit; $permit=1; $this->key=0; echo "OK!YOU CAN PASS"; } function __wakeup() { exit("nonono"); } } class E { public $key; public $link; function __destruct() { global $permit; $permit=0; } function __wakeup() { $this->key=0; phpinfo(); } } $ser = 'O:1:"C":2:{s:3:"key";N;s:4:"link";O:1:"B":2:{s:3:"key";i:1;s:4:"link";N;}}'; unserialize($ser);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NvcZn
function name:  (null)
number of ops:  6
compiled vars:  !0 = $ser
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   DECLARE_CLASS                                            'b'
   74     1        ASSIGN                                                   !0, 'O%3A1%3A%22C%22%3A2%3A%7Bs%3A3%3A%22key%22%3BN%3Bs%3A4%3A%22link%22%3BO%3A1%3A%22B%22%3A2%3A%7Bs%3A3%3A%22key%22%3Bi%3A1%3Bs%3A4%3A%22link%22%3BN%3B%7D%7D'
   75     2        INIT_FCALL                                               'unserialize'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
          5      > RETURN                                                   1

Class A:
Function __destruct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/NvcZn
function name:  __destruct
number of ops:  6
compiled vars:  !0 = $flag, !1 = $permit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_GLOBAL                                              !0, 'flag'
    7     1        BIND_GLOBAL                                              !1, 'permit'
    8     2        IS_EQUAL                                                 !1, 1
          3      > JMPZ                                                     ~2, ->5
    9     4    >   ECHO                                                     !0
   10     5    > > RETURN                                                   null

End of function __destruct

Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/NvcZn
function name:  __wakeup
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > EXIT                                                     'nonono'
   13     1*     > RETURN                                                   null

End of function __wakeup

End of class A.

Class B:
Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NvcZn
function name:  __destruct
number of ops:  4
compiled vars:  !0 = $file, !1 = $flag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   BIND_GLOBAL                                              !0, 'file'
   20     1        BIND_GLOBAL                                              !1, 'flag'
   21     2        ASSIGN                                                   !1, 'get_flag_contents'
   22     3      > RETURN                                                   null

End of function __destruct

Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NvcZn
function name:  __wakeup
number of ops:  5
compiled vars:  !0 = $file
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   BIND_GLOBAL                                              !0, 'file'
   25     1        ASSIGN_OBJ                                               'key'
          2        OP_DATA                                                  1
   26     3        ASSIGN                                                   !0, 'index.php'
   27     4      > RETURN                                                   null

End of function __wakeup

Function __tostring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NvcZn
function name:  __toString
number of ops:  8
compiled vars:  !0 = $link, !1 = $file
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   FETCH_OBJ_R                                      ~2      !0, 'key'
          1        IS_EQUAL                                                 ~2, 0
          2      > JMPZ                                                     ~3, ->6
   30     3    >   BIND_GLOBAL                                              !1, 'file'
   31     4        ASSIGN                                                   !1, 'flag.php'
   32     5      > RETURN                                                   'WOW%21%21%21'
   34     6    >   VERIFY_RETURN_TYPE                                       
          7      > RETURN                                                   null

End of function __tostring

End of class B.

Class C:
Function __destruct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/NvcZn
function name:  __destruct
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   FETCH_OBJ_R                                      ~0      'link'
          1        FETCH_OBJ_R                                      ~1      ~0, 'key'
          2        IS_EQUAL                                                 ~1, 1
          3      > JMPZ                                                     ~2, ->6
   41     4    >   FETCH_OBJ_R                                      ~3      'link'
          5        ECHO                                                     ~3
   42     6    > > RETURN                                                   null

End of function __destruct

Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/NvcZn
function name:  __wakeup
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E > > EXIT                                                     'nonono'
   45     1*     > RETURN                                                   null

End of function __wakeup

End of class C.

Class D:
Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NvcZn
function name:  __destruct
number of ops:  6
compiled vars:  !0 = $permit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E >   BIND_GLOBAL                                              !0, 'permit'
   52     1        ASSIGN                                                   !0, 1
   53     2        ASSIGN_OBJ                                               'key'
          3        OP_DATA                                                  0
   54     4        ECHO                                                     'OK%EF%BC%81YOU+CAN+PASS'
   55     5      > RETURN                                                   null

End of function __destruct

Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/NvcZn
function name:  __wakeup
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E > > EXIT                                                     'nonono'
   58     1*     > RETURN                                                   null

End of function __wakeup

End of class D.

Class E:
Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NvcZn
function name:  __destruct
number of ops:  3
compiled vars:  !0 = $permit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   64     0  E >   BIND_GLOBAL                                              !0, 'permit'
   65     1        ASSIGN                                                   !0, 0
   66     2      > RETURN                                                   null

End of function __destruct

Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NvcZn
function name:  __wakeup
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   68     0  E >   ASSIGN_OBJ                                               'key'
          1        OP_DATA                                                  0
   69     2        INIT_FCALL                                               'phpinfo'
          3        DO_ICALL                                                 
   70     4      > RETURN                                                   null

End of function __wakeup

End of class E.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.37 ms | 1469 KiB | 15 Q