Bug #73526 [Asn->Csd]: php_json_encode depth issue

From: Date: Sun, 20 Nov 2016 20:36:26 +0000
Subject: Bug #73526 [Asn->Csd]: php_json_encode depth issue
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205488@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73526&edit=1

 ID:                 73526
 Updated by:         bukka@php.net
 Reported by:        remi@php.net
 Summary:            php_json_encode depth issue
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            JSON related
 Operating System:   irrevelant
 PHP Version:        7.1.0RC6
 Assigned To:        bukka
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of bukka
Revision: http://git.php.net/?p=php-src.git;a=commit;h=60574ea1ac4790abe818c2c7510d0e391c12c06a
Log: Fix bug #73526 (php_json_encode depth issue)


Previous Comments:
------------------------------------------------------------------------
[2016-11-15 15:06:00] remi@php.net

AT least, using a correct initial value (GINIT) could be applied in 7.0/7.1 to avoid the
"undefined" behavior (having to run json_encode once to have the global value set)

------------------------------------------------------------------------
[2016-11-15 13:40:51] bukka@php.net

Well I prefer not to break BC for internal API in the last RC and try to have exactly the same
behaviour as it was in 7.0. I tried to do that before but forgot on fact that it should be also
changed when calling json_encode user function. It was always dependent on that global from what I
see (unless I missed something).

That being said I think it's worth it to consider changes in the json internal API in 7.2 which
I also hope to propose. I was thinking more about exposing json_encoder struct but you and Julien
might be right that this would be more consistent.

------------------------------------------------------------------------
[2016-11-15 13:09:41] remi@php.net

> So the actual fix to have it exactly the same as before is to just set the global in
> json_encode user func.

So you prefer to keep some "undefined" behavior ? ;)

------------------------------------------------------------------------
[2016-11-15 12:49:33] bukka@php.net

This will actually break the extensions that used that global to set max depth before. So the actual
fix to have it exactly the same as before is to just set the global in json_encode user func.

------------------------------------------------------------------------
[2016-11-15 10:44:02] remi@php.net

Notice that with this patch, the encode_max_depth global is no more used, so can be removed in 7.2.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=73526


--
Edit this bug report at https://bugs.php.net/bug.php?id=73526&edit=1


Thread (8 messages)

« previous php.bugs (#205488) next »