Bug #73526 [Asn]: php_json_encode depth issue
| From: | remi@php.net | Date: | Tue, 15 Nov 2016 15:06:01 +0000 |
| Subject: | Bug #73526 [Asn]: php_json_encode depth issue | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-205385@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: remi@php.net
Reported by: remi@php.net
Summary: php_json_encode depth issue
Status: Assigned
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:
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)
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[2016-11-15 10:43:04] remi@php.net
Description:
------------
Discussion on https://github.com/m6w6/ext-pq/issues/23
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73526&edit=1