3v4l.org

run code in 300+ PHP versions simultaneously
<?php $corrupted = <<<STRING a:4:{i:0;s:3:"three";i:1;s:5:"five";i:2;s:2:"newline1 newline2";i:3;s:6:"garçon";} STRING; $repaired = preg_replace_callback( '/s:(\d+):"(.*?)";/s', function ($m) { $len = strlen($m[2]); return $m[1] == $len ? $m[0] : "s:$len:\"{$m[2]}\";"; }, $corrupted ); echo $corrupted , "\n" , $repaired; echo "\n---\n"; var_export(unserialize($repaired));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FsZv1
function name:  (null)
number of ops:  19
compiled vars:  !0 = $corrupted, !1 = $repaired
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'a%3A4%3A%7Bi%3A0%3Bs%3A3%3A%22three%22%3Bi%3A1%3Bs%3A5%3A%22five%22%3Bi%3A2%3Bs%3A2%3A%22newline1%0Anewline2%22%3Bi%3A3%3Bs%3A6%3A%22gar%C3%A7on%22%3B%7D'
    7     1        INIT_FCALL                                               'preg_replace_callback'
    8     2        SEND_VAL                                                 '%2Fs%3A%28%5Cd%2B%29%3A%22%28.%2A%3F%29%22%3B%2Fs'
    9     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFsZv1%3A9%240'
   12     4        SEND_VAL                                                 ~3
   13     5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
    7     7        ASSIGN                                                   !1, $4
   16     8        ECHO                                                     !0
          9        ECHO                                                     '%0A'
         10        ECHO                                                     !1
   17    11        ECHO                                                     '%0A---%0A'
   18    12        INIT_FCALL                                               'var_export'
         13        INIT_FCALL                                               'unserialize'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $6      
         16        SEND_VAR                                                 $6
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FFsZv1%3A9%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FsZv1
function name:  {closure}
number of ops:  19
compiled vars:  !0 = $m, !1 = $len
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        FETCH_DIM_R                                      ~2      !0, 2
          2        STRLEN                                           ~3      ~2
          3        ASSIGN                                                   !1, ~3
   11     4        FETCH_DIM_R                                      ~5      !0, 1
          5        IS_EQUAL                                                 !1, ~5
          6      > JMPZ                                                     ~6, ->10
          7    >   FETCH_DIM_R                                      ~7      !0, 0
          8        QM_ASSIGN                                        ~8      ~7
          9      > JMP                                                      ->17
         10    >   ROPE_INIT                                     5  ~11     's%3A'
         11        ROPE_ADD                                      1  ~11     ~11, !1
         12        ROPE_ADD                                      2  ~11     ~11, '%3A%22'
         13        FETCH_DIM_R                                      ~9      !0, 2
         14        ROPE_ADD                                      3  ~11     ~11, ~9
         15        ROPE_END                                      4  ~10     ~11, '%22%3B'
         16        QM_ASSIGN                                        ~8      ~10
         17    > > RETURN                                                   ~8
   12    18*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FFsZv1%3A9%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.82 ms | 1400 KiB | 19 Q