3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { } $ref = new ReflectionClass('A'); var_dump(method_exists($ref, 'getDocComment')); //bool(true) var_dump($ref->getDocComment()); //bool(false) // serialize only the class name $refClass = unserialize(serialize($ref)); try { $refClass->getDocComment(); } catch (Error $e) { echo "Malformed Reflection object: ".$e->getMessage(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 26
Branch analysis from position: 26
2 jumps found. (Code = 107) Position 1 = 27, Position 2 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SliR1
function name:  (null)
number of ops:  32
compiled vars:  !0 = $ref, !1 = $refClass, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $3      'ReflectionClass'
          1        SEND_VAL_EX                                              'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
    4     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'method_exists'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 'getDocComment'
          8        DO_ICALL                                         $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                                 
    5    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'getDocComment'
         13        DO_FCALL                                      0  $8      
         14        SEND_VAR                                                 $8
         15        DO_ICALL                                                 
    8    16        INIT_FCALL                                               'unserialize'
         17        INIT_FCALL                                               'serialize'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $10     
         20        SEND_VAR                                                 $10
         21        DO_ICALL                                         $11     
         22        ASSIGN                                                   !1, $11
   10    23        INIT_METHOD_CALL                                         !1, 'getDocComment'
         24        DO_FCALL                                      0          
         25      > JMP                                                      ->31
   12    26  E > > CATCH                                       last         'Error'
   13    27    >   INIT_METHOD_CALL                                         !2, 'getMessage'
         28        DO_FCALL                                      0  $14     
         29        CONCAT                                           ~15     'Malformed+Reflection+object%3A+', $14
         30        ECHO                                                     ~15
   14    31    > > RETURN                                                   1

Class A: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.39 ms | 1020 KiB | 17 Q