@@ -31,8 +31,9 @@ public function strip($json)
31
31
list ($ index , $ return , $ char ) = [-1 , '' , '' ];
32
32
33
33
while (isset ($ json [++$ index ])) {
34
- list ($ prev , $ char, $ charnext ) = [$ char , $ json [$ index ], $ json [ $ index ] . ( $ json [ $ index + 1 ] ?? '' ) ];
34
+ list ($ prev , $ char ) = [$ char , $ json [$ index ]];
35
35
36
+ $ charnext = $ char . (isset ($ json [$ index + 1 ]) ? $ json [$ index + 1 ] : '' );
36
37
if ($ this ->inStringOrCommentEnd ($ prev , $ char , $ charnext )) {
37
38
$ return .= $ char ;
38
39
@@ -50,7 +51,7 @@ public function strip($json)
50
51
return $ return ;
51
52
}
52
53
53
- protected function inStringOrCommentEnd (string $ prev , string $ char , string $ charnext ): bool
54
+ protected function inStringOrCommentEnd ($ prev , $ char , $ charnext )
54
55
{
55
56
if (0 === $ this ->comment && $ char === '" ' && $ prev !== '\\' ) {
56
57
$ this ->inStr = !$ this ->inStr ;
@@ -63,7 +64,7 @@ protected function inStringOrCommentEnd(string $prev, string $char, string $char
63
64
return $ this ->inStr || 0 === $ this ->comment ;
64
65
}
65
66
66
- protected function hasCommentEnded (string $ char , string $ charnext ): bool
67
+ protected function hasCommentEnded ($ char , $ charnext )
67
68
{
68
69
$ singleEnded = $ this ->comment === 1 && $ char == "\n" ;
69
70
$ multiEnded = $ this ->comment === 2 && $ charnext == '*/ ' ;
0 commit comments