3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sugar_unserialize($value) { preg_match('/[oc]:\d+:/i', $value, $matches); if (count($matches)) { return false; } return unserialize($value); } $test1 = 'O:8:"stdClass":0:{}'; $test2 = 'O:+8:"stdClass":0:{}'; var_dump(sugar_unserialize($test1), sugar_unserialize($test2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oc2cY
function name:  (null)
number of ops:  13
compiled vars:  !0 = $test1, !1 = $test2
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  14     0  E >   QM_ASSIGN                                                !0
  15     1        QM_ASSIGN                                                !1
  17     2        INIT_FCALL                                               'var_dump'
         3        INIT_FCALL                                               'sugar_unserialize'
         4        SEND_VAR                                                 !0
         5        DO_FCALL                                      0  $4      
         6        SEND_VAR                                                 $4
         7        INIT_FCALL                                               'sugar_unserialize'
         8        SEND_VAR                                                 !1
         9        DO_FCALL                                      0  $5      
        10        SEND_VAR                                                 $5
        11        DO_ICALL                                                 
        12      > RETURN                                                   1

Function sugar_unserialize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oc2cY
function name:  sugar_unserialize
number of ops:  14
compiled vars:  !0 = $value, !1 = $matches
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   RECV                                             !0      
   5     1        INIT_FCALL                                               'preg_match'
         2        SEND_VAL                                                 '%2F%5Boc%5D%3A%5Cd%2B%3A%2Fi'
         3        SEND_VAR                                                 !0
         4        SEND_REF                                                 !1
         5        DO_ICALL                                                 
   7     6        COUNT                                            ~3      !1
         7      > JMPZ                                                     ~3, ->9
   8     8    > > RETURN                                                   <false>
  11     9    >   INIT_FCALL                                               'unserialize'
        10        SEND_VAR                                                 !0
        11        DO_ICALL                                         $4      
        12      > RETURN                                                   $4
  12    13*     > RETURN                                                   null

End of function sugar_unserialize

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
13.32 ms | 409 KiB | 7 Q