3v4l.org

run code in 500+ PHP versions simultaneously
<?php class JsonResponse { const DEFAULT_ENCODING_OPTIONS = 15; protected $encodingOptions = self::DEFAULT_ENCODING_OPTIONS; public function __construct($data = null) { $data = json_encode($data, $this->encodingOptions); } } class JsonSerializableObject implements \JsonSerializable { public function jsonSerialize() { throw new \Exception('This error is expected'); } } $serializable = new JsonSerializableObject(); new JsonResponse($serializable);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nAFVh
function name:  (null)
number of ops:  9
compiled vars:  !0 = $serializable
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   DECLARE_CLASS                                                'jsonserializableobject'
   22     1        NEW                                                  $1      'JsonSerializableObject'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   23     4        NEW                                                  $4      'JsonResponse'
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0          
          7        FREE                                                         $4
          8      > RETURN                                                       1

Class JsonResponse:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nAFVh
function name:  __construct
number of ops:  8
compiled vars:  !0 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV_INIT                                            !0      null
   10     1        INIT_FCALL                                                   'json_encode'
          2        SEND_VAR                                                     !0
          3        FETCH_OBJ_R                                          ~1      'encodingOptions'
          4        SEND_VAL                                                     ~1
          5        DO_ICALL                                             $2      
          6        ASSIGN                                                       !0, $2
   11     7      > RETURN                                                       null

End of function __construct

End of class JsonResponse.

Class JsonSerializableObject:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/nAFVh
function name:  jsonSerialize
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   NEW                                                  $0      'Exception'
          1        SEND_VAL_EX                                                  'This+error+is+expected'
          2        DO_FCALL                                          0          
          3      > THROW                                             0          $0
   19     4*     > RETURN                                                       null

End of function jsonserialize

End of class JsonSerializableObject.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
180.09 ms | 2474 KiB | 14 Q