3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Secured { public function __construct( private readonly \SensitiveParameterValue $content ) { } public static function fromString( #[\SensitiveParameter] string $value, ) { return new self(new \SensitiveParameterValue($value)); } public function __toString(): string { return '**SECRET**'; } public function __debugInfo(): ?array { return [ 'content' => '**SECRET**' ]; } public function __serialize(): array { return []; } public function __unserialize(array $data): void { throw new \RuntimeException('The ' . __CLASS__ . ' class cannot be unserialized.'); } } function t(string $n, callable $c) { echo "$n ::::::::::::::::::::::::::::::::::::::::" . PHP_EOL; try { $c(); } catch (Throwable $e) { echo $e->getMessage() . PHP_EOL; } echo PHP_EOL; } function test(Secured|SensitiveParameterValue $secured) { echo 'Test ' .get_class($secured). ' _____________________________________________________________' . PHP_EOL; t('var_dump', fn () => var_dump($secured)); t('serialize', fn () => var_dump(serialize($secured))); t('print_r', fn () => print_r($secured)); t('casting', fn () => var_dump((string) $secured)); t('var_export', fn () => var_dump(var_export($secured, true))); } test(Secured::fromString('Lorem ipsum dolor')); test(new \SensitiveParameterValue('Lorem ipsum dolor'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPXe0
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'secured'
   67     1        INIT_FCALL                                                   'test'
          2        INIT_STATIC_METHOD_CALL                                      'Secured', 'fromString'
          3        SEND_VAL_EX                                                  'Lorem+ipsum+dolor'
          4        DO_FCALL                                          0  $0      
          5        SEND_VAR                                                     $0
          6        DO_FCALL                                          0          
   68     7        INIT_FCALL                                                   'test'
          8        NEW                                                  $2      'SensitiveParameterValue'
          9        SEND_VAL_EX                                                  'Lorem+ipsum+dolor'
         10        DO_FCALL                                          0          
         11        SEND_VAR                                                     $2
         12        DO_FCALL                                          0          
         13      > RETURN                                                       1

Function t:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 9
Branch analysis from position: 9
2 jumps found. (Code = 107) Position 1 = 10, Position 2 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPXe0
function name:  t
number of ops:  16
compiled vars:  !0 = $n, !1 = $c, !2 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   42     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   44     2        NOP                                                          
          3        FAST_CONCAT                                          ~3      !0, '+%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A'
          4        CONCAT                                               ~4      ~3, '%0A'
          5        ECHO                                                         ~4
   46     6        INIT_DYNAMIC_CALL                                            !1
          7        DO_FCALL                                          0          
          8      > JMP                                                          ->14
   47     9  E > > CATCH                                           last         'Throwable'
   48    10    >   INIT_METHOD_CALL                                             !2, 'getMessage'
         11        DO_FCALL                                          0  $6      
         12        CONCAT                                               ~7      $6, '%0A'
         13        ECHO                                                         ~7
   51    14    >   ECHO                                                         '%0A'
   52    15      > RETURN                                                       null

End of function t

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPXe0
function name:  test
number of ops:  37
compiled vars:  !0 = $secured
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   54     0  E >   RECV                                                 !0      
   57     1        GET_CLASS                                            ~1      !0
          2        CONCAT                                               ~2      'Test+', ~1
          3        CONCAT                                               ~3      ~2, '+_____________________________________________________________'
          4        CONCAT                                               ~4      ~3, '%0A'
          5        ECHO                                                         ~4
   58     6        INIT_FCALL                                                   't'
          7        SEND_VAL                                                     'var_dump'
          8        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
          9        BIND_LEXICAL                                                 ~5, !0
         10        SEND_VAL                                                     ~5
         11        DO_FCALL                                          0          
   59    12        INIT_FCALL                                                   't'
         13        SEND_VAL                                                     'serialize'
         14        DECLARE_LAMBDA_FUNCTION                              ~7      [1]
         15        BIND_LEXICAL                                                 ~7, !0
         16        SEND_VAL                                                     ~7
         17        DO_FCALL                                          0          
   60    18        INIT_FCALL                                                   't'
         19        SEND_VAL                                                     'print_r'
         20        DECLARE_LAMBDA_FUNCTION                              ~9      [2]
         21        BIND_LEXICAL                                                 ~9, !0
         22        SEND_VAL                                                     ~9
         23        DO_FCALL                                          0          
   61    24        INIT_FCALL                                                   't'
         25        SEND_VAL                                                     'casting'
         26        DECLARE_LAMBDA_FUNCTION                              ~11     [3]
         27        BIND_LEXICAL                                                 ~11, !0
         28        SEND_VAL                                                     ~11
         29        DO_FCALL                                          0          
   62    30        INIT_FCALL                                                   't'
         31        SEND_VAL                                                     'var_export'
         32        DECLARE_LAMBDA_FUNCTION                              ~13     [4]
         33        BIND_LEXICAL                                                 ~13, !0
         34        SEND_VAL                                                     ~13
         35        DO_FCALL                                          0          
   65    36      > 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/IPXe0
function name:  {closure:test():58}
number of ops:  6
compiled vars:  !0 = $secured
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   58     0  E >   BIND_STATIC                                                  !0
          1        INIT_FCALL                                                   'var_dump'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $1      
          4      > RETURN                                                       $1
          5*     > 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/IPXe0
function name:  {closure:test():59}
number of ops:  9
compiled vars:  !0 = $secured
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   59     0  E >   BIND_STATIC                                                  !0
          1        INIT_FCALL                                                   'var_dump'
          2        INIT_FCALL                                                   'serialize'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $1      
          5        SEND_VAR                                                     $1
          6        DO_ICALL                                             $2      
          7      > RETURN                                                       $2
          8*     > RETURN                                                       null

End of Dynamic Function 1

Dynamic Function 2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPXe0
function name:  {closure:test():60}
number of ops:  6
compiled vars:  !0 = $secured
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   60     0  E >   BIND_STATIC                                                  !0
          1        INIT_FCALL                                                   'print_r'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $1      
          4      > RETURN                                                       $1
          5*     > RETURN                                                       null

End of Dynamic Function 2

Dynamic Function 3
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPXe0
function name:  {closure:test():61}
number of ops:  7
compiled vars:  !0 = $secured
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   61     0  E >   BIND_STATIC                                                  !0
          1        INIT_FCALL                                                   'var_dump'
          2        CAST                                              6  ~1      !0
          3        SEND_VAL                                                     ~1
          4        DO_ICALL                                             $2      
          5      > RETURN                                                       $2
          6*     > RETURN                                                       null

End of Dynamic Function 3

Dynamic Function 4
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPXe0
function name:  {closure:test():62}
number of ops:  10
compiled vars:  !0 = $secured
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   62     0  E >   BIND_STATIC                                                  !0
          1        INIT_FCALL                                                   'var_dump'
          2        INIT_FCALL                                                   'var_export'
          3        SEND_VAR                                                     !0
          4        SEND_VAL                                                     <true>
          5        DO_ICALL                                             $1      
          6        SEND_VAR                                                     $1
          7        DO_ICALL                                             $2      
          8      > RETURN                                                       $2
          9*     > RETURN                                                       null

End of Dynamic Function 4

End of function test

Class Secured:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPXe0
function name:  __construct
number of ops:  4
compiled vars:  !0 = $content
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
          1        ASSIGN_OBJ                                                   'content'
          2        OP_DATA                                                      !0
    9     3      > RETURN                                                       null

End of function __construct

Function fromstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPXe0
function name:  fromString
number of ops:  9
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
   16     1        NEW                              self                $1      
          2        NEW                                                  $2      'SensitiveParameterValue'
          3        SEND_VAR_EX                                                  !0
          4        DO_FCALL                                          0          
          5        SEND_VAR_NO_REF_EX                                           $2
          6        DO_FCALL                                          0          
          7      > RETURN                                                       $1
   17     8*     > RETURN                                                       null

End of function fromstring

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPXe0
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E > > RETURN                                                       '%2A%2ASECRET%2A%2A'
   22     1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function __tostring

Function __debuginfo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPXe0
function name:  __debugInfo
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E > > RETURN                                                       <array>
   29     1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function __debuginfo

Function __serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPXe0
function name:  __serialize
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   33     0  E > > RETURN                                                       <array>
   34     1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function __serialize

Function __unserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/IPXe0
function name:  __unserialize
number of ops:  6
compiled vars:  !0 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   36     0  E >   RECV                                                 !0      
   38     1        NEW                                                  $1      'RuntimeException'
          2        SEND_VAL_EX                                                  'The+Secured+class+cannot+be+unserialized.'
          3        DO_FCALL                                          0          
          4      > THROW                                             0          $1
   39     5*     > RETURN                                                       null

End of function __unserialize

End of class Secured.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
141.24 ms | 888 KiB | 19 Q