3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Mocking WordPress function add_filter(string $tag, callable $value) { $GLOBALS[$tag][] = $value; } function _doing_it_wrong($fn, string $message) { echo "\n--------------\nDOING IT WRONG: $message\n--------------\n"; } // ------------------------------------------------------------------ function apply_filters_typesafe( $tag, $arguments = array(), $value = null, ...$values ) { if ( null === $value || empty( $GLOBALS[$tag] ) ) { return $value; } $type = gettype( $value ); $is_object = false; switch ( $type ) { case 'boolean': $accepted_types = array( 'boolean' ); break; case 'integer': case 'double': $accepted_types = array( 'numeric' ); break; case 'string': $accepted_types = array( 'string' ); break; case 'array': $accepted_types = array( 'array' ); break; case 'resource': case 'resource (closed)': $accepted_types = array( 'resource' ); break; case 'object': $is_object = true; default: $accepted_types = array(); } // Skip calculation of accepted types if they are are explicitly passed. if ( $is_object && empty ( $arguments['accepted_types'] ) ) { $class = get_class( $value ); $accepted_types = array( $class ); $parent = get_parent_class( $class ); while ( $parent ) { $accepted_types[] = $parent; $parent = get_parent_class( $parent ); } $accepted_types = array_merge( $accepted_types, class_implements( $class ) ); } $arguments = array_replace( array( 'nullable' => false, 'accepted_types' => $accepted_types ), $arguments ); $original = $value; // Objects are passed by ref, clone to return original unchanged in case of errors. $to_filter = $is_object ? clone $value : $value; $filter = array_shift($GLOBALS[$tag]); $filtered = $filter( $tag, $to_filter, ...$values ); // 'mixed' is a valid PHP 8 pseudo-type so we support for consistency. // That said, if mixed is fine then just use apply_filters. if ( in_array( 'mixed', (array)$arguments['accepted_types'] ) ) { return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $filtered, ...$values ) : $filtered; } static $can_do_it_wrong = false; if ( ! $can_do_it_wrong && function_exists( '_doing_it_wrong' ) ) { $can_do_it_wrong = true; } if ( ( null === $filtered && !$arguments['nullable'] ) ) { if ( $can_do_it_wrong ) { _doing_it_wrong( __FUNCTION__, "Filters for '$tag' where not expected to return null.", '5.6' ); } return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $original, ...$values ) : $filtered; } static $functions; if ( ! $functions ) { $functions = array( 'integer' => 'is_int', 'double' => 'is_float', 'float' => 'is_float', 'numeric' => 'is_numeric', 'number' => 'is_numeric', 'bool' => 'is_bool', 'boolean' => 'is_boolean', 'string' => 'is_string', 'array' => 'is_array', 'callable' => 'is_callable', 'function' => 'is_callable', 'resource' => 'is_resource', 'iterable' => 'is_iterable', 'countable' => 'is_countable', ); } foreach ( $arguments['accepted_types'] as $type ) { if ( isset( $functions[ $type ] ) && call_user_func( $functions[ $type ], $filtered ) ) { return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $filtered, ...$values ) : $filtered; } if ( $is_object && is_string ( $type ) && is_a( $filtered, $type ) ) { return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $filtered, ...$values ) : $filtered; } } if ( $can_do_it_wrong ) { $expected = implode( "', '", $arguments['accepted_types'] ); $actual = is_object( $filtered ) ? 'instance of ' . get_class($filtered) : gettype( $filtered ); _doing_it_wrong( __FUNCTION__, "Filters for '$tag' where expected to return a value of one of types: '$expected'. Got '$actual' instead.", '5.6' ); } return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $original, ...$values ) : $filtered; } // Let's try now to add some hooks, the first is bad, the second is good. add_filter('hello', function () { return 'This is not a callable' ; }); add_filter('hello', function () { return function () { return 'It works!'; }; }); // And lets' see if it works: $callable = apply_filters_typesafe('hello', ['accepted_types' => ['callable']], '__return_empty_string'); echo $callable();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X392p
function name:  (null)
number of ops:  20
compiled vars:  !0 = $callable
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  153     0  E >   INIT_FCALL                                                   'add_filter'
          1        SEND_VAL                                                     'hello'
          2        DECLARE_LAMBDA_FUNCTION                              ~1      [0]
  155     3        SEND_VAL                                                     ~1
  153     4        DO_FCALL                                          0          
  157     5        INIT_FCALL                                                   'add_filter'
          6        SEND_VAL                                                     'hello'
          7        DECLARE_LAMBDA_FUNCTION                              ~3      [1]
  161     8        SEND_VAL                                                     ~3
  157     9        DO_FCALL                                          0          
  166    10        INIT_FCALL                                                   'apply_filters_typesafe'
         11        SEND_VAL                                                     'hello'
         12        SEND_VAL                                                     <array>
         13        SEND_VAL                                                     '__return_empty_string'
         14        DO_FCALL                                          0  $5      
         15        ASSIGN                                                       !0, $5
  167    16        INIT_DYNAMIC_CALL                                            !0
         17        DO_FCALL                                          0  $7      
         18        ECHO                                                         $7
         19      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X392p
function name:  {closure:/in/X392p:153}
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  154     0  E > > RETURN                                                       'This+is+not+a+callable'
  155     1*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X392p
function name:  {closure:/in/X392p:157}
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  158     0  E >   DECLARE_LAMBDA_FUNCTION                              ~0      [0]
  160     1      > RETURN                                                       ~0
  161     2*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X392p
function name:  {closure:{closure:/in/X392p:157}:158}
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  159     0  E > > RETURN                                                       'It+works%21'
  160     1*     > RETURN                                                       null

End of Dynamic Function 0

End of Dynamic Function 1

Function add_filter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X392p
function name:  add_filter
number of ops:  6
compiled vars:  !0 = $tag, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    4     2        FETCH_W                          global              $2      !0
          3        ASSIGN_DIM                                                   $2
          4        OP_DATA                                                      !1
    5     5      > RETURN                                                       null

End of function add_filter

Function _doing_it_wrong:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X392p
function name:  _doing_it_wrong
number of ops:  7
compiled vars:  !0 = $fn, !1 = $message
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    8     2        ROPE_INIT                                         3  ~3      '%0A--------------%0ADOING+IT+WRONG%3A+'
          3        ROPE_ADD                                          1  ~3      ~3, !1
          4        ROPE_END                                          2  ~2      ~3, '%0A--------------%0A'
          5        ECHO                                                         ~2
    9     6      > RETURN                                                       null

End of function _doing_it_wrong

Function apply_filters_typesafe:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
10 jumps found. (Code = 188) Position 1 = 31, Position 2 = 33, Position 3 = 33, Position 4 = 35, Position 5 = 37, Position 6 = 39, Position 7 = 39, Position 8 = 41, Position 9 = 42, Position 10 = 14
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 46) Position 1 = 44, Position 2 = 46
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 71
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
2 jumps found. (Code = 44) Position 1 = 63, Position 2 = 56
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 80, Position 2 = 83
Branch analysis from position: 80
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 101, Position 2 = 114
Branch analysis from position: 101
2 jumps found. (Code = 43) Position 1 = 103, Position 2 = 112
Branch analysis from position: 103
1 jumps found. (Code = 42) Position 1 = 113
Branch analysis from position: 113
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 112
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 114
2 jumps found. (Code = 46) Position 1 = 117, Position 2 = 121
Branch analysis from position: 117
2 jumps found. (Code = 43) Position 1 = 122, Position 2 = 123
Branch analysis from position: 122
2 jumps found. (Code = 46) Position 1 = 125, Position 2 = 128
Branch analysis from position: 125
2 jumps found. (Code = 43) Position 1 = 129, Position 2 = 151
Branch analysis from position: 129
2 jumps found. (Code = 43) Position 1 = 130, Position 2 = 138
Branch analysis from position: 130
2 jumps found. (Code = 43) Position 1 = 140, Position 2 = 149
Branch analysis from position: 140
1 jumps found. (Code = 42) Position 1 = 150
Branch analysis from position: 150
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 149
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 138
Branch analysis from position: 151
2 jumps found. (Code = 43) Position 1 = 154, Position 2 = 155
Branch analysis from position: 154
2 jumps found. (Code = 77) Position 1 = 157, Position 2 = 205
Branch analysis from position: 157
2 jumps found. (Code = 78) Position 1 = 158, Position 2 = 205
Branch analysis from position: 158
2 jumps found. (Code = 46) Position 1 = 160, Position 2 = 165
Branch analysis from position: 160
2 jumps found. (Code = 43) Position 1 = 166, Position 2 = 180
Branch analysis from position: 166
2 jumps found. (Code = 43) Position 1 = 168, Position 2 = 177
Branch analysis from position: 168
1 jumps found. (Code = 42) Position 1 = 178
Branch analysis from position: 178
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 177
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 180
2 jumps found. (Code = 46) Position 1 = 181, Position 2 = 183
Branch analysis from position: 181
2 jumps found. (Code = 46) Position 1 = 184, Position 2 = 189
Branch analysis from position: 184
2 jumps found. (Code = 43) Position 1 = 190, Position 2 = 204
Branch analysis from position: 190
2 jumps found. (Code = 43) Position 1 = 192, Position 2 = 201
Branch analysis from position: 192
1 jumps found. (Code = 42) Position 1 = 202
Branch analysis from position: 202
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 201
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 204
1 jumps found. (Code = 42) Position 1 = 157
Branch analysis from position: 157
Branch analysis from position: 189
Branch analysis from position: 183
Branch analysis from position: 165
Branch analysis from position: 205
2 jumps found. (Code = 43) Position 1 = 207, Position 2 = 231
Branch analysis from position: 207
2 jumps found. (Code = 43) Position 1 = 212, Position 2 = 216
Branch analysis from position: 212
1 jumps found. (Code = 42) Position 1 = 218
Branch analysis from position: 218
2 jumps found. (Code = 43) Position 1 = 233, Position 2 = 242
Branch analysis from position: 233
1 jumps found. (Code = 42) Position 1 = 243
Branch analysis from position: 243
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 242
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 216
2 jumps found. (Code = 43) Position 1 = 233, Position 2 = 242
Branch analysis from position: 233
Branch analysis from position: 242
Branch analysis from position: 231
Branch analysis from position: 205
Branch analysis from position: 155
Branch analysis from position: 128
Branch analysis from position: 123
Branch analysis from position: 121
Branch analysis from position: 83
2 jumps found. (Code = 43) Position 1 = 101, Position 2 = 114
Branch analysis from position: 101
Branch analysis from position: 114
Branch analysis from position: 56
2 jumps found. (Code = 44) Position 1 = 63, Position 2 = 56
Branch analysis from position: 63
Branch analysis from position: 56
Branch analysis from position: 71
Branch analysis from position: 46
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 33
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 39
Branch analysis from position: 41
2 jumps found. (Code = 46) Position 1 = 44, Position 2 = 46
Branch analysis from position: 44
Branch analysis from position: 46
Branch analysis from position: 42
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 31
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 33
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 33
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 35
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 37
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 39
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 39
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 41
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 41
Branch analysis from position: 39
Branch analysis from position: 39
Branch analysis from position: 37
Branch analysis from position: 35
Branch analysis from position: 33
Branch analysis from position: 33
Branch analysis from position: 31
Branch analysis from position: 8
filename:       /in/X392p
function name:  apply_filters_typesafe
number of ops:  245
compiled vars:  !0 = $tag, !1 = $arguments, !2 = $value, !3 = $values, !4 = $type, !5 = $is_object, !6 = $accepted_types, !7 = $class, !8 = $parent, !9 = $original, !10 = $to_filter, !11 = $filter, !12 = $filtered, !13 = $can_do_it_wrong, !14 = $functions, !15 = $expected, !16 = $actual
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      <array>
          2        RECV_INIT                                            !2      null
          3        RECV_VARIADIC                                        !3      
   15     4        TYPE_CHECK                                        2  ~17     !2
          5      > JMPNZ_EX                                             ~17     ~17, ->8
          6    >   ISSET_ISEMPTY_VAR                                 3  ~18     !0
          7        BOOL                                                 ~17     ~18
          8    > > JMPZ                                                         ~17, ->10
   16     9    > > RETURN                                                       !2
   19    10    >   GET_TYPE                                             ~19     !2
         11        ASSIGN                                                       !4, ~19
   20    12        ASSIGN                                                       !5, <false>
   21    13      > SWITCH_STRING                                                !4, [ 'boolean':->31, 'integer':->33, 'double':->33, 'string':->35, 'array':->37, 'resource':->39, 'resource+%28closed%29':->39, 'object':->41, ], ->42
   22    14    >   IS_EQUAL                                                     !4, 'boolean'
         15      > JMPNZ                                                        ~22, ->31
   25    16    >   IS_EQUAL                                                     !4, 'integer'
         17      > JMPNZ                                                        ~22, ->33
   26    18    >   IS_EQUAL                                                     !4, 'double'
         19      > JMPNZ                                                        ~22, ->33
   29    20    >   IS_EQUAL                                                     !4, 'string'
         21      > JMPNZ                                                        ~22, ->35
   32    22    >   IS_EQUAL                                                     !4, 'array'
         23      > JMPNZ                                                        ~22, ->37
   35    24    >   IS_EQUAL                                                     !4, 'resource'
         25      > JMPNZ                                                        ~22, ->39
   36    26    >   IS_EQUAL                                                     !4, 'resource+%28closed%29'
         27      > JMPNZ                                                        ~22, ->39
   39    28    >   IS_EQUAL                                                     !4, 'object'
         29      > JMPNZ                                                        ~22, ->41
         30    > > JMP                                                          ->42
   23    31    >   ASSIGN                                                       !6, <array>
   24    32      > JMP                                                          ->43
   27    33    >   ASSIGN                                                       !6, <array>
   28    34      > JMP                                                          ->43
   30    35    >   ASSIGN                                                       !6, <array>
   31    36      > JMP                                                          ->43
   33    37    >   ASSIGN                                                       !6, <array>
   34    38      > JMP                                                          ->43
   37    39    >   ASSIGN                                                       !6, <array>
   38    40      > JMP                                                          ->43
   40    41    >   ASSIGN                                                       !5, <true>
   42    42    >   ASSIGN                                                       !6, <array>
   46    43    > > JMPZ_EX                                              ~30     !5, ->46
         44    >   ISSET_ISEMPTY_DIM_OBJ                             1  ~31     !1, 'accepted_types'
         45        BOOL                                                 ~30     ~31
         46    > > JMPZ                                                         ~30, ->71
   47    47    >   GET_CLASS                                            ~32     !2
         48        ASSIGN                                                       !7, ~32
   48    49        INIT_ARRAY                                           ~34     !7
         50        ASSIGN                                                       !6, ~34
   49    51        INIT_FCALL                                                   'get_parent_class'
         52        SEND_VAR                                                     !7
         53        DO_ICALL                                             $36     
         54        ASSIGN                                                       !8, $36
   50    55      > JMP                                                          ->62
   51    56    >   ASSIGN_DIM                                                   !6
         57        OP_DATA                                                      !8
   52    58        INIT_FCALL                                                   'get_parent_class'
         59        SEND_VAR                                                     !8
         60        DO_ICALL                                             $39     
         61        ASSIGN                                                       !8, $39
   50    62    > > JMPNZ                                                        !8, ->56
   55    63    >   INIT_FCALL                                                   'array_merge'
         64        SEND_VAR                                                     !6
         65        INIT_FCALL                                                   'class_implements'
         66        SEND_VAR                                                     !7
         67        DO_ICALL                                             $41     
         68        SEND_VAR                                                     $41
         69        DO_ICALL                                             $42     
         70        ASSIGN                                                       !6, $42
   58    71    >   INIT_FCALL                                                   'array_replace'
   60    72        INIT_ARRAY                                           ~44     <false>, 'nullable'
   61    73        ADD_ARRAY_ELEMENT                                    ~44     !6, 'accepted_types'
         74        SEND_VAL                                                     ~44
   63    75        SEND_VAR                                                     !1
   58    76        DO_ICALL                                             $45     
         77        ASSIGN                                                       !1, $45
   66    78        ASSIGN                                                       !9, !2
   68    79      > JMPZ                                                         !5, ->83
         80    >   CLONE                                                ~48     !2
         81        QM_ASSIGN                                            ~49     ~48
         82      > JMP                                                          ->84
         83    >   QM_ASSIGN                                            ~49     !2
         84    >   ASSIGN                                                       !10, ~49
   70    85        INIT_FCALL                                                   'array_shift'
         86        FETCH_W                          global              $51     !0
         87        SEND_REF                                                     $51
         88        DO_ICALL                                             $52     
         89        ASSIGN                                                       !11, $52
   72    90        INIT_DYNAMIC_CALL                                            !11
         91        SEND_VAR_EX                                                  !0
         92        SEND_VAR_EX                                                  !10
         93        SEND_UNPACK                                                  !3
         94        CHECK_UNDEF_ARGS                                             
         95        DO_FCALL                                          1  $54     
         96        ASSIGN                                                       !12, $54
   76    97        FETCH_DIM_R                                          ~56     !1, 'accepted_types'
         98        CAST                                              7  ~57     ~56
         99        FRAMELESS_ICALL_2                in_array            ~58     'mixed', ~57
        100      > JMPZ                                                         ~58, ->114
   77   101    >   FETCH_R                          global              ~59     !0
        102      > JMPZ                                                         ~59, ->112
   78   103    >   INIT_FCALL_BY_NAME                                           'apply_filters_typesafe'
        104        SEND_VAR_EX                                                  !0
        105        SEND_VAR_EX                                                  !1
        106        SEND_VAR_EX                                                  !12
        107        SEND_UNPACK                                                  !3
        108        CHECK_UNDEF_ARGS                                             
        109        DO_FCALL                                          1  $60     
        110        QM_ASSIGN                                            ~61     $60
        111      > JMP                                                          ->113
   79   112    >   QM_ASSIGN                                            ~61     !12
        113    > > RETURN                                                       ~61
   82   114    >   BIND_STATIC                                                  !13
   83   115        BOOL_NOT                                             ~62     !13
        116      > JMPZ_EX                                              ~62     ~62, ->121
        117    >   INIT_FCALL                                                   'function_exists'
        118        SEND_VAL                                                     '_doing_it_wrong'
        119        DO_ICALL                                             $63     
        120        BOOL                                                 ~62     $63
        121    > > JMPZ                                                         ~62, ->123
   84   122    >   ASSIGN                                                       !13, <true>
   87   123    >   TYPE_CHECK                                        2  ~65     !12
        124      > JMPZ_EX                                              ~65     ~65, ->128
        125    >   FETCH_DIM_R                                          ~66     !1, 'nullable'
        126        BOOL_NOT                                             ~67     ~66
        127        BOOL                                                 ~65     ~67
        128    > > JMPZ                                                         ~65, ->151
   88   129    > > JMPZ                                                         !13, ->138
   89   130    >   INIT_FCALL                                                   '_doing_it_wrong'
   90   131        SEND_VAL                                                     'apply_filters_typesafe'
   91   132        ROPE_INIT                                         3  ~69     'Filters+for+%27'
        133        ROPE_ADD                                          1  ~69     ~69, !0
        134        ROPE_END                                          2  ~68     ~69, '%27+where+not+expected+to+return+null.'
        135        SEND_VAL                                                     ~68
   92   136        SEND_VAL                                                     '5.6'
   89   137        DO_FCALL                                          0          
   96   138    >   FETCH_R                          global              ~72     !0
        139      > JMPZ                                                         ~72, ->149
   97   140    >   INIT_FCALL_BY_NAME                                           'apply_filters_typesafe'
        141        SEND_VAR_EX                                                  !0
        142        SEND_VAR_EX                                                  !1
        143        SEND_VAR_EX                                                  !9
        144        SEND_UNPACK                                                  !3
        145        CHECK_UNDEF_ARGS                                             
        146        DO_FCALL                                          1  $73     
        147        QM_ASSIGN                                            ~74     $73
        148      > JMP                                                          ->150
   98   149    >   QM_ASSIGN                                            ~74     !12
        150    > > RETURN                                                       ~74
  101   151    >   BIND_STATIC                                                  !14
  102   152        BOOL_NOT                                             ~75     !14
        153      > JMPZ                                                         ~75, ->155
  103   154    >   ASSIGN                                                       !14, <array>
  121   155    >   FETCH_DIM_R                                          ~77     !1, 'accepted_types'
        156      > FE_RESET_R                                           $78     ~77, ->205
        157    > > FE_FETCH_R                                                   $78, !4, ->205
  122   158    >   ISSET_ISEMPTY_DIM_OBJ                             0  ~79     !14, !4
        159      > JMPZ_EX                                              ~79     ~79, ->165
        160    >   FETCH_DIM_R                                          ~80     !14, !4
        161        INIT_USER_CALL                                    1          'call_user_func', ~80
        162        SEND_USER                                                    !12
        163        DO_FCALL                                          0  $81     
        164        BOOL                                                 ~79     $81
        165    > > JMPZ                                                         ~79, ->180
  123   166    >   FETCH_R                          global              ~82     !0
        167      > JMPZ                                                         ~82, ->177
  124   168    >   INIT_FCALL_BY_NAME                                           'apply_filters_typesafe'
        169        SEND_VAR_EX                                                  !0
        170        SEND_VAR_EX                                                  !1
        171        SEND_VAR_EX                                                  !12
        172        SEND_UNPACK                                                  !3
        173        CHECK_UNDEF_ARGS                                             
        174        DO_FCALL                                          1  $83     
        175        QM_ASSIGN                                            ~84     $83
        176      > JMP                                                          ->178
  125   177    >   QM_ASSIGN                                            ~84     !12
        178    >   FE_FREE                                                      $78
        179      > RETURN                                                       ~84
  128   180    > > JMPZ_EX                                              ~85     !5, ->183
        181    >   TYPE_CHECK                                       64  ~86     !4
        182        BOOL                                                 ~85     ~86
        183    > > JMPZ_EX                                              ~85     ~85, ->189
        184    >   INIT_FCALL                                                   'is_a'
        185        SEND_VAR                                                     !12
        186        SEND_VAR                                                     !4
        187        DO_ICALL                                             $87     
        188        BOOL                                                 ~85     $87
        189    > > JMPZ                                                         ~85, ->204
  129   190    >   FETCH_R                          global              ~88     !0
        191      > JMPZ                                                         ~88, ->201
  130   192    >   INIT_FCALL_BY_NAME                                           'apply_filters_typesafe'
        193        SEND_VAR_EX                                                  !0
        194        SEND_VAR_EX                                                  !1
        195        SEND_VAR_EX                                                  !12
        196        SEND_UNPACK                                                  !3
        197        CHECK_UNDEF_ARGS                                             
        198        DO_FCALL                                          1  $89     
        199        QM_ASSIGN                                            ~90     $89
        200      > JMP                                                          ->202
  131   201    >   QM_ASSIGN                                            ~90     !12
        202    >   FE_FREE                                                      $78
        203      > RETURN                                                       ~90
  121   204    > > JMP                                                          ->157
        205    >   FE_FREE                                                      $78
  135   206      > JMPZ                                                         !13, ->231
  136   207    >   FETCH_DIM_R                                          ~91     !1, 'accepted_types'
        208        FRAMELESS_ICALL_2                implode             ~92     '%27%2C+%27', ~91
        209        ASSIGN                                                       !15, ~92
  137   210        TYPE_CHECK                                      256          !12
        211      > JMPZ                                                         ~94, ->216
        212    >   GET_CLASS                                            ~95     !12
        213        CONCAT                                               ~96     'instance+of+', ~95
        214        QM_ASSIGN                                            ~97     ~96
        215      > JMP                                                          ->218
        216    >   GET_TYPE                                             ~98     !12
        217        QM_ASSIGN                                            ~97     ~98
        218    >   ASSIGN                                                       !16, ~97
  138   219        INIT_FCALL                                                   '_doing_it_wrong'
  139   220        SEND_VAL                                                     'apply_filters_typesafe'
  140   221        ROPE_INIT                                         7  ~101    'Filters+for+%27'
        222        ROPE_ADD                                          1  ~101    ~101, !0
        223        ROPE_ADD                                          2  ~101    ~101, '%27+where+expected+to+return+a+value+of+one+of+types%3A+%27'
        224        ROPE_ADD                                          3  ~101    ~101, !15
        225        ROPE_ADD                                          4  ~101    ~101, '%27.+Got+%27'
        226        ROPE_ADD                                          5  ~101    ~101, !16
        227        ROPE_END                                          6  ~100    ~101, '%27+instead.'
        228        SEND_VAL                                                     ~100
  141   229        SEND_VAL                                                     '5.6'
  138   230        DO_FCALL                                          0          
  145   231    >   FETCH_R                          global              ~106    !0
        232      > JMPZ                                                         ~106, ->242
  146   233    >   INIT_FCALL_BY_NAME                                           'apply_filters_typesafe'
        234        SEND_VAR_EX                                                  !0
        235        SEND_VAR_EX                                                  !1
        236        SEND_VAR_EX                                                  !9
        237        SEND_UNPACK                                                  !3
        238        CHECK_UNDEF_ARGS                                             
        239        DO_FCALL                                          1  $107    
        240        QM_ASSIGN                                            ~108    $107
        241      > JMP                                                          ->243
  147   242    >   QM_ASSIGN                                            ~108    !12
        243    > > RETURN                                                       ~108
  148   244*     > RETURN                                                       null

End of function apply_filters_typesafe

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
137.12 ms | 521 KiB | 19 Q