diff --git a/src/HJSON/HJSONParser.php b/src/HJSON/HJSONParser.php index 1ba5e06..b6c110d 100644 --- a/src/HJSON/HJSONParser.php +++ b/src/HJSON/HJSONParser.php @@ -368,9 +368,8 @@ private function peek($offs) { $index = $this->at + $offs; - // Mimic old behavior with mb_substr if ($index < 0) { - $index = 0; + return null; } if ($index >= $this->textLengthChars) { return ""; diff --git a/tests/assets/failStr9a_test.hjson b/tests/assets/failStr9a_test.hjson new file mode 100644 index 0000000..229b94d --- /dev/null +++ b/tests/assets/failStr9a_test.hjson @@ -0,0 +1,4 @@ +[ +[ += +[['''''' diff --git a/tests/assets/strings3_result.hjson b/tests/assets/strings3_result.hjson new file mode 100644 index 0000000..e16c76d --- /dev/null +++ b/tests/assets/strings3_result.hjson @@ -0,0 +1 @@ +"" diff --git a/tests/assets/strings3_result.json b/tests/assets/strings3_result.json new file mode 100644 index 0000000..e16c76d --- /dev/null +++ b/tests/assets/strings3_result.json @@ -0,0 +1 @@ +"" diff --git a/tests/assets/strings3_test.hjson b/tests/assets/strings3_test.hjson new file mode 100644 index 0000000..9cad736 --- /dev/null +++ b/tests/assets/strings3_test.hjson @@ -0,0 +1 @@ +''''''