From 8cbbdd94cbf557cddbee52c5753af4de5b8a07f5 Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Thu, 14 Mar 2024 14:33:15 +0300 Subject: [PATCH] Removing slashes which escape quotes inside strings --- jzon.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jzon.inc.php b/jzon.inc.php index 29efc35..081aba7 100644 --- a/jzon.inc.php +++ b/jzon.inc.php @@ -249,7 +249,9 @@ class jzonParser { $end = $this->c; ++$this->c; - return substr($this->in, $start, $end - $start); + $str = substr($this->in, $start, $end - $start); + //let's remove escape slashes before " + return str_replace('\\"', '"', $str); } $prev = $this->in[$this->c]; ++$this->c; @@ -351,6 +353,7 @@ function jzon_parse($str) else { $p = new jzonParser($str); - return $p->parse(); + $res = $p->parse(); + return $res; } }