3v4l.org

run code in 500+ PHP versions simultaneously
<?php class ApiController { /* * * Public methods meant to be exposed... * */ protected function protectedMethod() { echo "This should be protected!"; } public function handle($method) { if (!is_callable(array($this, $method))) { die("Not callable!"); } $refMethod = new ReflectionMethod($this, $method); $refMethod->invoke($this); // No visibility check } } // Simulate a web request $api = new ApiController(); $api->handle('protectedMethod');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IODNa
function name:  (null)
number of ops:  7
compiled vars:  !0 = $api
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   29     0  E >   NEW                                                  $1      'ApiController'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   30     3        INIT_METHOD_CALL                                             !0, 'handle'
          4        SEND_VAL_EX                                                  'protectedMethod'
          5        DO_FCALL                                          0          
          6      > RETURN                                                       1

Class ApiController:
Function protectedmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IODNa
function name:  protectedMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   ECHO                                                         'This+should+be+protected%21'
   14     1      > RETURN                                                       null

End of function protectedmethod

Function handle:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 61) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IODNa
function name:  handle
number of ops:  23
compiled vars:  !0 = $method, !1 = $refMethod
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
   18     1        INIT_FCALL                                                   'is_callable'
          2        FETCH_THIS                                           ~2      
          3        INIT_ARRAY                                           ~3      ~2
          4        ADD_ARRAY_ELEMENT                                    ~3      !0
          5        SEND_VAL                                                     ~3
          6        DO_ICALL                                             $4      
          7        BOOL_NOT                                             ~5      $4
          8      > JMPZ                                                         ~5, ->12
   20     9    > > INIT_FCALL                                                   'exit'
         10*       SEND_VAL                                                     'Not+callable%21'
         11*       DO_ICALL                                                     
   23    12    >   NEW                                                  $7      'ReflectionMethod'
         13        FETCH_THIS                                           $8      
         14        SEND_VAR_EX                                                  $8
         15        SEND_VAR_EX                                                  !0
         16        DO_FCALL                                          0          
         17        ASSIGN                                                       !1, $7
   24    18        INIT_METHOD_CALL                                             !1, 'invoke'
         19        FETCH_THIS                                           $11     
         20        SEND_VAR_EX                                                  $11
         21        DO_FCALL                                          0          
   25    22      > RETURN                                                       null

End of function handle

End of class ApiController.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.92 ms | 3458 KiB | 15 Q