3v4l.org

run code in 500+ PHP versions simultaneously
<?php class WP_Term { public $foo = 'foo'; public $data; // Change the visibility to protected or private and the script will throw an error. } $_POST['action'] = 'action'; function wp_parse_args( $args, $defaults = array() ) { if ( is_object( $args ) ) { $parsed_args = get_object_vars( $args ); } elseif ( is_array( $args ) ) { $parsed_args =& $args; } else { wp_parse_str( $args, $parsed_args ); } if ( is_array( $defaults ) && $defaults ) { return array_merge( $defaults, $parsed_args ); } return $parsed_args; } class WP_Ajax_Response { public $responses = array(); public function add( $args = '' ) { $defaults = array( 'what' => 'object', 'action' => false, 'id' => '0', 'old_id' => false, 'position' => 1, 'data' => '', 'supplemental' => array(), ); $parsed_args = wp_parse_args( $args, $defaults ); $position = preg_replace( '/[^a-z0-9:_-]/i', '', $parsed_args['position'] ); $id = $parsed_args['id']; $what = $parsed_args['what']; $action = $parsed_args['action']; $old_id = $parsed_args['old_id']; $data = $parsed_args['data']; $response = "<response_data><![CDATA[$data]]></response_data>"; $s = ''; if ( is_array( $parsed_args['supplemental'] ) ) { foreach ( $parsed_args['supplemental'] as $k => $v ) { $s .= "<$k><![CDATA[$v]]></$k>"; } $s = "<supplemental>$s</supplemental>"; } if ( false === $action ) { $action = $_POST['action']; } $x = ''; $x .= "<response action='{$action}_$id'>"; // The action attribute in the xml output is formatted like a nonce action. $x .= "<$what id='$id' " . ( false === $old_id ? '' : "old_id='$old_id' " ) . "position='$position'>"; $x .= $response; $x .= $s; $x .= "</$what>"; $x .= '</response>'; $this->responses[] = $x; return $x; } } $response = new WP_Ajax_Response(); $tag = new WP_Term(); $response->add( array( 'what' => 'term', 'supplemental' => (array) $tag, ) ); libxml_use_internal_errors( true ); $xml = simplexml_load_string( $response->responses[0], 'SimpleXMLElement' ); if ( $xml === false ) { echo 'Failed loading XML: '; foreach ( libxml_get_errors() as $error ) { // Display each error echo '<br>', $error->message . "\n"; } // Clear the error buffer to free memory libxml_clear_errors(); } else { // Your XML is correctly parsed, proceed with your logic echo 'XML loaded successfully.' . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 41
Branch analysis from position: 27
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 37
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 37
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XQL4f
function name:  (null)
number of ops:  43
compiled vars:  !0 = $response, !1 = $tag, !2 = $xml, !3 = $error
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   FETCH_W                          global              $4      '_POST'
          1        ASSIGN_DIM                                                   $4, 'action'
          2        OP_DATA                                                      'action'
   77     3        NEW                                                  $6      'WP_Ajax_Response'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !0, $6
   78     6        NEW                                                  $9      'WP_Term'
          7        DO_FCALL                                          0          
          8        ASSIGN                                                       !1, $9
   80     9        INIT_METHOD_CALL                                             !0, 'add'
   82    10        INIT_ARRAY                                           ~12     'term', 'what'
   83    11        CAST                                              7  ~13     !1
         12        ADD_ARRAY_ELEMENT                                    ~12     ~13, 'supplemental'
         13        SEND_VAL_EX                                                  ~12
   80    14        DO_FCALL                                          0          
   87    15        INIT_FCALL                                                   'libxml_use_internal_errors'
         16        SEND_VAL                                                     <true>
         17        DO_ICALL                                                     
   88    18        INIT_FCALL                                                   'simplexml_load_string'
         19        FETCH_OBJ_R                                          ~16     !0, 'responses'
         20        FETCH_DIM_R                                          ~17     ~16, 0
         21        SEND_VAL                                                     ~17
         22        SEND_VAL                                                     'SimpleXMLElement'
         23        DO_ICALL                                             $18     
         24        ASSIGN                                                       !2, $18
   90    25        TYPE_CHECK                                        4          !2
         26      > JMPZ                                                         ~20, ->41
   91    27    >   ECHO                                                         'Failed+loading+XML%3A+'
   92    28        INIT_FCALL                                                   'libxml_get_errors'
         29        DO_ICALL                                             $21     
         30      > FE_RESET_R                                           $22     $21, ->37
         31    > > FE_FETCH_R                                                   $22, !3, ->37
   94    32    >   ECHO                                                         '%3Cbr%3E'
         33        FETCH_OBJ_R                                          ~23     !3, 'message'
         34        CONCAT                                               ~24     ~23, '%0A'
         35        ECHO                                                         ~24
   92    36      > JMP                                                          ->31
         37    >   FE_FREE                                                      $22
   97    38        INIT_FCALL                                                   'libxml_clear_errors'
         39        DO_ICALL                                                     
   90    40      > JMP                                                          ->42
  100    41    >   ECHO                                                         'XML+loaded+successfully.%0A'
  101    42    > > RETURN                                                       1

Function wp_parse_args:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 26
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
Branch analysis from position: 20
filename:       /in/XQL4f
function name:  wp_parse_args
number of ops:  28
compiled vars:  !0 = $args, !1 = $defaults, !2 = $parsed_args
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      <array>
   11     2        TYPE_CHECK                                      256          !0
          3      > JMPZ                                                         ~3, ->9
   12     4    >   INIT_FCALL                                                   'get_object_vars'
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                             $4      
          7        ASSIGN                                                       !2, $4
   11     8      > JMP                                                          ->17
   13     9    >   TYPE_CHECK                                      128          !0
         10      > JMPZ                                                         ~6, ->13
   14    11    >   ASSIGN_REF                                                   !2, !0
   13    12      > JMP                                                          ->17
   16    13    >   INIT_FCALL_BY_NAME                                           'wp_parse_str'
         14        SEND_VAR_EX                                                  !0
         15        SEND_VAR_EX                                                  !2
         16        DO_FCALL                                          0          
   19    17    >   TYPE_CHECK                                      128  ~9      !1
         18      > JMPZ_EX                                              ~9      ~9, ->20
         19    >   BOOL                                                 ~9      !1
         20    > > JMPZ                                                         ~9, ->26
   20    21    >   INIT_FCALL                                                   'array_merge'
         22        SEND_VAR                                                     !1
         23        SEND_VAR                                                     !2
         24        DO_ICALL                                             $10     
         25      > RETURN                                                       $10
   23    26    > > RETURN                                                       !2
   24    27*     > RETURN                                                       null

End of function wp_parse_args

Class WP_Term: [no user functions]
Class WP_Ajax_Response:
Function add:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 47
Branch analysis from position: 29
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 42
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 42
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 52
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 68
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 68
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
Branch analysis from position: 42
Branch analysis from position: 47
filename:       /in/XQL4f
function name:  add
number of ops:  90
compiled vars:  !0 = $args, !1 = $defaults, !2 = $parsed_args, !3 = $position, !4 = $id, !5 = $what, !6 = $action, !7 = $old_id, !8 = $data, !9 = $response, !10 = $s, !11 = $v, !12 = $k, !13 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   RECV_INIT                                            !0      ''
   31     1        ASSIGN                                                       !1, <array>
   41     2        INIT_FCALL                                                   'wp_parse_args'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        DO_FCALL                                          0  $15     
          6        ASSIGN                                                       !2, $15
   43     7        FETCH_DIM_R                                          ~17     !2, 'position'
          8        FRAMELESS_ICALL_3                preg_replace        ~18     '%2F%5B%5Ea-z0-9%3A_-%5D%2Fi', ''
          9        OP_DATA                                                      ~17
         10        ASSIGN                                                       !3, ~18
   44    11        FETCH_DIM_R                                          ~20     !2, 'id'
         12        ASSIGN                                                       !4, ~20
   45    13        FETCH_DIM_R                                          ~22     !2, 'what'
         14        ASSIGN                                                       !5, ~22
   46    15        FETCH_DIM_R                                          ~24     !2, 'action'
         16        ASSIGN                                                       !6, ~24
   47    17        FETCH_DIM_R                                          ~26     !2, 'old_id'
         18        ASSIGN                                                       !7, ~26
   48    19        FETCH_DIM_R                                          ~28     !2, 'data'
         20        ASSIGN                                                       !8, ~28
   50    21        ROPE_INIT                                         3  ~31     '%3Cresponse_data%3E%3C%21%5BCDATA%5B'
         22        ROPE_ADD                                          1  ~31     ~31, !8
         23        ROPE_END                                          2  ~30     ~31, '%5D%5D%3E%3C%2Fresponse_data%3E'
         24        ASSIGN                                                       !9, ~30
   52    25        ASSIGN                                                       !10, ''
   53    26        FETCH_DIM_R                                          ~35     !2, 'supplemental'
         27        TYPE_CHECK                                      128          ~35
         28      > JMPZ                                                         ~36, ->47
   54    29    >   FETCH_DIM_R                                          ~37     !2, 'supplemental'
         30      > FE_RESET_R                                           $38     ~37, ->42
         31    > > FE_FETCH_R                                           ~39     $38, !11, ->42
         32    >   ASSIGN                                                       !12, ~39
   55    33        ROPE_INIT                                         7  ~42     '%3C'
         34        ROPE_ADD                                          1  ~42     ~42, !12
         35        ROPE_ADD                                          2  ~42     ~42, '%3E%3C%21%5BCDATA%5B'
         36        ROPE_ADD                                          3  ~42     ~42, !11
         37        ROPE_ADD                                          4  ~42     ~42, '%5D%5D%3E%3C%2F'
         38        ROPE_ADD                                          5  ~42     ~42, !12
         39        ROPE_END                                          6  ~41     ~42, '%3E'
         40        ASSIGN_OP                                         8          !10, ~41
   54    41      > JMP                                                          ->31
         42    >   FE_FREE                                                      $38
   57    43        ROPE_INIT                                         3  ~48     '%3Csupplemental%3E'
         44        ROPE_ADD                                          1  ~48     ~48, !10
         45        ROPE_END                                          2  ~47     ~48, '%3C%2Fsupplemental%3E'
         46        ASSIGN                                                       !10, ~47
   60    47    >   TYPE_CHECK                                        4          !6
         48      > JMPZ                                                         ~51, ->52
   61    49    >   FETCH_R                          global              ~52     '_POST'
         50        FETCH_DIM_R                                          ~53     ~52, 'action'
         51        ASSIGN                                                       !6, ~53
   63    52    >   ASSIGN                                                       !13, ''
   64    53        ROPE_INIT                                         5  ~57     '%3Cresponse+action%3D%27'
         54        ROPE_ADD                                          1  ~57     ~57, !6
         55        ROPE_ADD                                          2  ~57     ~57, '_'
         56        ROPE_ADD                                          3  ~57     ~57, !4
         57        ROPE_END                                          4  ~56     ~57, '%27%3E'
         58        ASSIGN_OP                                         8          !13, ~56
   65    59        ROPE_INIT                                         5  ~62     '%3C'
         60        ROPE_ADD                                          1  ~62     ~62, !5
         61        ROPE_ADD                                          2  ~62     ~62, '+id%3D%27'
         62        ROPE_ADD                                          3  ~62     ~62, !4
         63        ROPE_END                                          4  ~61     ~62, '%27+'
         64        TYPE_CHECK                                        4          !7
         65      > JMPZ                                                         ~65, ->68
         66    >   QM_ASSIGN                                            ~66     ''
         67      > JMP                                                          ->72
         68    >   ROPE_INIT                                         3  ~68     'old_id%3D%27'
         69        ROPE_ADD                                          1  ~68     ~68, !7
         70        ROPE_END                                          2  ~67     ~68, '%27+'
         71        QM_ASSIGN                                            ~66     ~67
         72    >   CONCAT                                               ~70     ~61, ~66
         73        ROPE_INIT                                         3  ~72     'position%3D%27'
         74        ROPE_ADD                                          1  ~72     ~72, !3
         75        ROPE_END                                          2  ~71     ~72, '%27%3E'
         76        CONCAT                                               ~74     ~70, ~71
         77        ASSIGN_OP                                         8          !13, ~74
   66    78        ASSIGN_OP                                         8          !13, !9
   67    79        ASSIGN_OP                                         8          !13, !10
   68    80        ROPE_INIT                                         3  ~79     '%3C%2F'
         81        ROPE_ADD                                          1  ~79     ~79, !5
         82        ROPE_END                                          2  ~78     ~79, '%3E'
         83        ASSIGN_OP                                         8          !13, ~78
   69    84        ASSIGN_OP                                         8          !13, '%3C%2Fresponse%3E'
   71    85        FETCH_OBJ_W                                          $83     'responses'
         86        ASSIGN_DIM                                                   $83
         87        OP_DATA                                                      !13
   73    88      > RETURN                                                       !13
   74    89*     > RETURN                                                       null

End of function add

End of class WP_Ajax_Response.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.08 ms | 1415 KiB | 20 Q