php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73526 php_json_encode depth issue
Submitted: 2016-11-15 10:43 UTC Modified: 2016-11-20 20:40 UTC
From: remi@php.net Assigned: bukka (profile)
Status: Closed Package: JSON related
PHP Version: 7.1.0RC6 OS: irrevelant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: remi@php.net
New email:
PHP Version: OS:

 

 [2016-11-15 10:43 UTC] remi@php.net
Description:
------------
Discussion on https://github.com/m6w6/ext-pq/issues/23




Patches

json_encode-depth.patch (last revision 2016-11-15 10:43 UTC by remi)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-15 10:44 UTC] 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 12:49 UTC] bukka@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: bukka
 [2016-11-15 12:49 UTC] 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 13:09 UTC] 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 13:40 UTC] 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 15:06 UTC] 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-20 20:36 UTC] bukka@php.net
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)
 [2016-11-20 20:36 UTC] bukka@php.net
-Status: Assigned +Status: Closed
 [2016-11-20 20:38 UTC] bukka@php.net
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)
 [2016-11-20 20:39 UTC] bukka@php.net
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)
 [2016-11-20 20:40 UTC] bukka@php.net
Yeah agreed. GINIT change merged to 7.0 up
 [2016-11-30 23:14 UTC] davey@php.net
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)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC