3v4l.org

run code in 500+ PHP versions simultaneously
<?php class WeakAnalysingMapRepro { /** @var workaround https://github.com/php/php-src/issues/13612, remove once PHP 8.3 support is dropped */ private \stdClass $destructedEarly; public array $destroyed = []; public array $ownerDestructorHandlers = []; public function __construct() { $this->destructedEarly = new \stdClass(); $handler = new class($this, $this->destructedEarly) { private \WeakReference $weakAnalysingMap; private \WeakReference $weakAnalysingMapDestructedEarly; public function __construct(WeakAnalysingMapRepro $analysingMap, \stdClass $destructedEarly) { $this->weakAnalysingMap = \WeakReference::create($analysingMap); $this->weakAnalysingMapDestructedEarly = \WeakReference::create($destructedEarly); } public function __destruct() { if ($this->weakAnalysingMapDestructedEarly->get() === null) { return; } var_dump($this->weakAnalysingMap->get()); } }; $this->destroyed[] = 1; $this->ownerDestructorHandlers[] = $handler; } } new WeakAnalysingMapRepro(); echo 'DONE';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nUMJD
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   40     0  E >   NEW                                                  $0      'WeakAnalysingMapRepro'
          1        DO_FCALL                                          0          
          2        FREE                                                         $0
   42     3        ECHO                                                         'DONE'
          4      > RETURN                                                       1

Class class@anonymous:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nUMJD
function name:  __construct
number of ops:  13
compiled vars:  !0 = $analysingMap, !1 = $destructedEarly
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   21     2        INIT_STATIC_METHOD_CALL                                      'WeakReference', 'create'
          3        SEND_VAR                                                     !0
          4        DO_FCALL                                          0  $3      
          5        ASSIGN_OBJ                                                   'weakAnalysingMap'
          6        OP_DATA                                                      $3
   22     7        INIT_STATIC_METHOD_CALL                                      'WeakReference', 'create'
          8        SEND_VAR                                                     !1
          9        DO_FCALL                                          0  $5      
         10        ASSIGN_OBJ                                                   'weakAnalysingMapDestructedEarly'
         11        OP_DATA                                                      $5
   23    12      > RETURN                                                       null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nUMJD
function name:  __destruct
number of ops:  13
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   FETCH_OBJ_R                                          ~0      'weakAnalysingMapDestructedEarly'
          1        INIT_METHOD_CALL                                             ~0, 'get'
          2        DO_FCALL                                          0  $1      
          3        TYPE_CHECK                                        2          $1
          4      > JMPZ                                                         ~2, ->6
   28     5    > > RETURN                                                       null
   31     6    >   INIT_FCALL                                                   'var_dump'
          7        FETCH_OBJ_R                                          ~3      'weakAnalysingMap'
          8        INIT_METHOD_CALL                                             ~3, 'get'
          9        DO_FCALL                                          0  $4      
         10        SEND_VAR                                                     $4
         11        DO_ICALL                                                     
   32    12      > RETURN                                                       null

End of function __destruct

End of class class@anonymous.

Class WeakAnalysingMapRepro:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nUMJD
function name:  __construct
number of ops:  20
compiled vars:  !0 = $handler
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   NEW                                                  $2      'stdClass'
          1        DO_FCALL                                          0          
          2        ASSIGN_OBJ                                                   'destructedEarly'
          3        OP_DATA                                                      $2
   15     4        DECLARE_ANON_CLASS                                   <unknown> 
          5        NEW                                                  $5      $4
          6        FETCH_THIS                                           $6      
          7        SEND_VAR_EX                                                  $6
          8        CHECK_FUNC_ARG                                               
          9        FETCH_OBJ_FUNC_ARG                                   $7      'destructedEarly'
         10        SEND_FUNC_ARG                                                $7
         11        DO_FCALL                                          0          
         12        ASSIGN                                                       !0, $5
   35    13        FETCH_OBJ_W                                          $10     'destroyed'
         14        ASSIGN_DIM                                                   $10
         15        OP_DATA                                                      1
   36    16        FETCH_OBJ_W                                          $12     'ownerDestructorHandlers'
         17        ASSIGN_DIM                                                   $12
         18        OP_DATA                                                      !0
   37    19      > RETURN                                                       null

End of function __construct

End of class WeakAnalysingMapRepro.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
145.14 ms | 491 KiB | 10 Q