3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = ' <span id="pass_AwfpSYYUsn" data-id="AwfpSYYUsn" class="pointer unlockFieldChild" data-client="51" data-status="closed"><i class="fa fa-lock"></i> Show</span> <!-- OTHER HTML STUFF --> <span id="pass_DbTD7TjEDX" data-id="DbTD7TjEDX" class="pointer unlockFieldChild" data-client="51" data-status="closed"><i class="fa fa-lock"></i> Show</span> '; $dom = new DOMDocument; $state = libxml_use_internal_errors(true); $dom->loadHTML('<div id="root">' . $content . '</div>'); $xp = new DOMXPath($dom); $nodeList = $xp->query('//span[starts-with(@id, "pass_")]'); foreach ($nodeList as $node) { $idpass = explode('_', $node->getAttribute('id'), 2)[1]; $pw = 'Free sauerkraut for all!'; /* This checks and fills the password, not really relvant to the question */ /* if ($aG->getCanPassword()) { $p = $em->getRepository('AppBundle:PasswordList')->findOneBy(['code' => $idpass]); if ($p !== null) { $pw = $p->getPass(); } }*/ $textNode = $dom->createTextNode('[pass id="' . $idpass . '"]' . $pw . '[/pass]'); $node->parentNode->replaceChild($textNode, $node); } $content = ''; foreach($dom->getElementById('root')->childNodes as $childNode) { $content .= $dom->saveHTML($childNode); } libxml_use_internal_errors($state); echo $content;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 48
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 48
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 48
2 jumps found. (Code = 77) Position 1 = 55, Position 2 = 61
Branch analysis from position: 55
2 jumps found. (Code = 78) Position 1 = 56, Position 2 = 61
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
Branch analysis from position: 48
filename:       /in/WHOFo
function name:  (null)
number of ops:  67
compiled vars:  !0 = $content, !1 = $dom, !2 = $state, !3 = $xp, !4 = $nodeList, !5 = $node, !6 = $idpass, !7 = $pw, !8 = $textNode, !9 = $childNode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%0A++++%3Cspan+id%3D%22pass_AwfpSYYUsn%22+data-id%3D%22AwfpSYYUsn%22+class%3D%22pointer+unlockFieldChild%22+data-client%3D%2251%22+data-status%3D%22closed%22%3E%3Ci+class%3D%22fa+fa-lock%22%3E%3C%2Fi%3E+Show%3C%2Fspan%3E%0A++++%3C%21--+OTHER+HTML+STUFF+--%3E%0A++++%3Cspan+id%3D%22pass_DbTD7TjEDX%22+data-id%3D%22DbTD7TjEDX%22+class%3D%22pointer+unlockFieldChild%22+data-client%3D%2251%22+data-status%3D%22closed%22%3E%3Ci+class%3D%22fa+fa-lock%22%3E%3C%2Fi%3E+Show%3C%2Fspan%3E%0A++'
    9     1        NEW                                              $11     'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $11
   10     4        INIT_FCALL                                               'libxml_use_internal_errors'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $14     
          7        ASSIGN                                                   !2, $14
   11     8        INIT_METHOD_CALL                                         !1, 'loadHTML'
          9        CONCAT                                           ~16     '%3Cdiv+id%3D%22root%22%3E', !0
         10        CONCAT                                           ~17     ~16, '%3C%2Fdiv%3E'
         11        SEND_VAL_EX                                              ~17
         12        DO_FCALL                                      0          
   12    13        NEW                                              $19     'DOMXPath'
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !3, $19
   13    17        INIT_METHOD_CALL                                         !3, 'query'
         18        SEND_VAL_EX                                              '%2F%2Fspan%5Bstarts-with%28%40id%2C+%22pass_%22%29%5D'
         19        DO_FCALL                                      0  $22     
         20        ASSIGN                                                   !4, $22
   15    21      > FE_RESET_R                                       $24     !4, ->48
         22    > > FE_FETCH_R                                               $24, !5, ->48
   16    23    >   INIT_FCALL                                               'explode'
         24        SEND_VAL                                                 '_'
         25        INIT_METHOD_CALL                                         !5, 'getAttribute'
         26        SEND_VAL_EX                                              'id'
         27        DO_FCALL                                      0  $25     
         28        SEND_VAR                                                 $25
         29        SEND_VAL                                                 2
         30        DO_ICALL                                         $26     
         31        FETCH_DIM_R                                      ~27     $26, 1
         32        ASSIGN                                                   !6, ~27
   18    33        ASSIGN                                                   !7, 'Free+sauerkraut+for+all%21'
   26    34        INIT_METHOD_CALL                                         !1, 'createTextNode'
         35        CONCAT                                           ~30     '%5Bpass+id%3D%22', !6
         36        CONCAT                                           ~31     ~30, '%22%5D'
         37        CONCAT                                           ~32     ~31, !7
         38        CONCAT                                           ~33     ~32, '%5B%2Fpass%5D'
         39        SEND_VAL_EX                                              ~33
         40        DO_FCALL                                      0  $34     
         41        ASSIGN                                                   !8, $34
   27    42        FETCH_OBJ_R                                      ~36     !5, 'parentNode'
         43        INIT_METHOD_CALL                                         ~36, 'replaceChild'
         44        SEND_VAR_EX                                              !8
         45        SEND_VAR_EX                                              !5
         46        DO_FCALL                                      0          
   15    47      > JMP                                                      ->22
         48    >   FE_FREE                                                  $24
   30    49        ASSIGN                                                   !0, ''
   32    50        INIT_METHOD_CALL                                         !1, 'getElementById'
         51        SEND_VAL_EX                                              'root'
         52        DO_FCALL                                      0  $39     
         53        FETCH_OBJ_R                                      ~40     $39, 'childNodes'
         54      > FE_RESET_R                                       $41     ~40, ->61
         55    > > FE_FETCH_R                                               $41, !9, ->61
   33    56    >   INIT_METHOD_CALL                                         !1, 'saveHTML'
         57        SEND_VAR_EX                                              !9
         58        DO_FCALL                                      0  $42     
         59        ASSIGN_OP                                     8          !0, $42
   32    60      > JMP                                                      ->55
         61    >   FE_FREE                                                  $41
   35    62        INIT_FCALL                                               'libxml_use_internal_errors'
         63        SEND_VAR                                                 !2
         64        DO_ICALL                                                 
   36    65        ECHO                                                     !0
         66      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
240.18 ms | 1008 KiB | 15 Q