3v4l.org

run code in 500+ PHP versions simultaneously
<?php $dom = null; $dt = null; $impl = null; function doThing() { $my_arr = []; global $dom,$dt,$impl; for($x = 0; $x < 7; $x++) { $dom = new \DOMDocument(); $dom->loadHTML("<!DOCTYPE html><p>hello</p>"); $impl = new \DOMImplementation(); $dt = $impl->createDocumentType("html", "", ""); array_push($my_arr, $dt, $dom, $impl); } $dom = new \DOMDocument(); $dom->loadHTML("<!DOCTYPE html><p>hello</p>"); $impl = new \DOMImplementation(); $dt = $impl->createDocumentType("html", "", ""); } //gc_collect_cycles(); doThing(); gc_collect_cycles(); $dom->replaceChild($dt, $dom->doctype); // FREE THE FIRST TIME! doThing(); // fill up tcache; coimment this out for tcache double free malding gc_collect_cycles(); // FREE AGAIN
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N6CNZ
function name:  (null)
number of ops:  18
compiled vars:  !0 = $dom, !1 = $dt, !2 = $impl
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, null
    4     1        ASSIGN                                                       !1, null
    5     2        ASSIGN                                                       !2, null
   28     3        INIT_FCALL                                                   'dothing'
          4        DO_FCALL                                          0          
   29     5        INIT_FCALL                                                   'gc_collect_cycles'
          6        DO_ICALL                                                     
   30     7        INIT_METHOD_CALL                                             !0, 'replaceChild'
          8        SEND_VAR_EX                                                  !1
          9        CHECK_FUNC_ARG                                               
         10        FETCH_OBJ_FUNC_ARG                                   $8      !0, 'doctype'
         11        SEND_FUNC_ARG                                                $8
         12        DO_FCALL                                          0          
   32    13        INIT_FCALL                                                   'dothing'
         14        DO_FCALL                                          0          
   33    15        INIT_FCALL                                                   'gc_collect_cycles'
         16        DO_ICALL                                                     
         17      > RETURN                                                       1

Function dothing:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 6
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 6
Branch analysis from position: 30
Branch analysis from position: 6
filename:       /in/N6CNZ
function name:  doThing
number of ops:  46
compiled vars:  !0 = $my_arr, !1 = $dom, !2 = $dt, !3 = $impl, !4 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                       !0, <array>
   10     1        BIND_GLOBAL                                                  !1, 'dom'
          2        BIND_GLOBAL                                                  !2, 'dt'
          3        BIND_GLOBAL                                                  !3, 'impl'
   12     4        ASSIGN                                                       !4, 0
          5      > JMP                                                          ->28
   13     6    >   NEW                                                  $7      'DOMDocument'
          7        DO_FCALL                                          0          
          8        ASSIGN                                                       !1, $7
   14     9        INIT_METHOD_CALL                                             !1, 'loadHTML'
         10        SEND_VAL_EX                                                  '%3C%21DOCTYPE+html%3E%3Cp%3Ehello%3C%2Fp%3E'
         11        DO_FCALL                                          0          
   15    12        NEW                                                  $11     'DOMImplementation'
         13        DO_FCALL                                          0          
         14        ASSIGN                                                       !3, $11
   16    15        INIT_METHOD_CALL                                             !3, 'createDocumentType'
         16        SEND_VAL_EX                                                  'html'
         17        SEND_VAL_EX                                                  ''
         18        SEND_VAL_EX                                                  ''
         19        DO_FCALL                                          0  $14     
         20        ASSIGN                                                       !2, $14
   18    21        INIT_FCALL                                                   'array_push'
         22        SEND_REF                                                     !0
         23        SEND_VAR                                                     !2
         24        SEND_VAR                                                     !1
         25        SEND_VAR                                                     !3
         26        DO_ICALL                                                     
   12    27        PRE_INC                                                      !4
         28    >   IS_SMALLER                                                   !4, 7
         29      > JMPNZ                                                        ~18, ->6
   21    30    >   NEW                                                  $19     'DOMDocument'
         31        DO_FCALL                                          0          
         32        ASSIGN                                                       !1, $19
   22    33        INIT_METHOD_CALL                                             !1, 'loadHTML'
         34        SEND_VAL_EX                                                  '%3C%21DOCTYPE+html%3E%3Cp%3Ehello%3C%2Fp%3E'
         35        DO_FCALL                                          0          
   23    36        NEW                                                  $23     'DOMImplementation'
         37        DO_FCALL                                          0          
         38        ASSIGN                                                       !3, $23
   24    39        INIT_METHOD_CALL                                             !3, 'createDocumentType'
         40        SEND_VAL_EX                                                  'html'
         41        SEND_VAL_EX                                                  ''
         42        SEND_VAL_EX                                                  ''
         43        DO_FCALL                                          0  $26     
         44        ASSIGN                                                       !2, $26
   25    45      > RETURN                                                       null

End of function dothing

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
141.53 ms | 1421 KiB | 12 Q