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() { echo "我是C的des"; 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/FmTdP
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'
   75     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'
   76     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/FmTdP
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/FmTdP
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/FmTdP
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/FmTdP
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/FmTdP
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 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/FmTdP
function name:  __destruct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   ECHO                                                     '%E6%88%91%E6%98%AFC%E7%9A%84des'
   41     1        FETCH_OBJ_R                                      ~0      'link'
          2        FETCH_OBJ_R                                      ~1      ~0, 'key'
          3        IS_EQUAL                                                 ~1, 1
          4      > JMPZ                                                     ~2, ->7
   42     5    >   FETCH_OBJ_R                                      ~3      'link'
          6        ECHO                                                     ~3
   43     7    > > 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/FmTdP
function name:  __wakeup
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E > > EXIT                                                     'nonono'
   46     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/FmTdP
function name:  __destruct
number of ops:  6
compiled vars:  !0 = $permit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   52     0  E >   BIND_GLOBAL                                              !0, 'permit'
   53     1        ASSIGN                                                   !0, 1
   54     2        ASSIGN_OBJ                                               'key'
          3        OP_DATA                                                  0
   55     4        ECHO                                                     'OK%EF%BC%81YOU+CAN+PASS'
   56     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/FmTdP
function name:  __wakeup
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   58     0  E > > EXIT                                                     'nonono'
   59     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/FmTdP
function name:  __destruct
number of ops:  3
compiled vars:  !0 = $permit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   65     0  E >   BIND_GLOBAL                                              !0, 'permit'
   66     1        ASSIGN                                                   !0, 0
   67     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/FmTdP
function name:  __wakeup
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   69     0  E >   ASSIGN_OBJ                                               'key'
          1        OP_DATA                                                  0
   70     2        INIT_FCALL                                               'phpinfo'
          3        DO_ICALL                                                 
   71     4      > RETURN                                                   null

End of function __wakeup

End of class E.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.79 ms | 1469 KiB | 15 Q