Re: com php-src: json_encode(): Detect recursion earlier: ext/json/json_encoder.c ext/json/tests/003.phpt ext/json/tests/004.phpt
ext/json/tests/bug61978.phpt
| From: | Nikita Popov | Date: | Sat, 19 Nov 2016 23:23:44 +0000 |
| Subject: | Re: com php-src: json_encode(): Detect recursion earlier: ext/json/json_encoder.c ext/json/tests/003.phpt ext/json/tests/004.phpt ext/json/tests/bug61978.phpt |
||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-95887@lists.php.net to get a copy of this message | ||
On Sun, Nov 20, 2016 at 12:07 AM, Kalle Sommer Nielsen <kalle@php.net>
wrote:
> Hi Nikita
>
> 2016-11-19 23:52 GMT+01:00 Nikita Popov <nikic@php.net>:
> > Commit: 8113daef499d7d56cb9b5877b27c26667469615a
> > Author: Nikita Popov <nikic@php.net> Sat, 19 Nov 2016
> 23:24:07 +0100
> > Parents: 40f6438972e6c9b4684ea9476fdaf29857cf5fe2
> > Branches: master
> >
> > Link:
> > http://git.php.net/?p=php-src.git;a=commitdiff;h=
> 8113daef499d7d56cb9b5877b27c26667469615a
> >
> > Log:
> > json_encode(): Detect recursion earlier
> >
> > json_encode() used a peculiar way of apply-count management,
> > whereby the apply-count was not incremented for the outermost
> > object/array, so that recursion was only detected after two
> > levels.
>
> This sounds worthy of at least a note in UPGRADING.
>
It isn't. The only way you'd notice is if you used
JSON_PARTIAL_OUTPUT_ON_ERROR in conjunction with a top-level recursive
structure.
I'm only fixing this because was trying to use json_encode() to force a
non-zero apply-count for some testing, and it did not behave as expected.
Nikita