php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77387 Recursion detection broken when printing GLOBALS
Submitted: 2018-12-31 10:40 UTC Modified: 2018-12-31 14:53 UTC
From: sjon at hortensius dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 7.3.0 OS: archlinux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sjon at hortensius dot net
New email:
PHP Version: OS:

 

 [2018-12-31 10:40 UTC] sjon at hortensius dot net
Description:
------------
I found this while going through https://3v4l.org/bughunt/7.3.0/7.2.13+7.2.12. Previously when printing _GLOBALS - recursion was detected and prevented. This seems broken

Test script:
---------------
See https://3v4l.org/AdLgJ

print_r($GLOBALS);

Expected result:
----------------
Array ( ... ) [GLOBALS] => Array *RECURSION* )

Actual result:
--------------
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 31461376 bytes) in /in/AdLgJ on line 3

Process exited with code 255.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-12-31 14:53 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: *General Issues +Package: Scripting Engine problem
 [2018-12-31 14:53 UTC] cmb@php.net
> I found this while going through
> https://3v4l.org/bughunt/7.3.0/7.2.13+7.2.12.

Highly appreciated – thanks!

This bug is caused by refactoring the recursion protection[1].
The Z_REFCOUNTED_P() check[2] fails for $GLOBALS, so the recursion
protection is not applied.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=cb9d81ef4f07f82835273800b0cb3d6a67816050>
[2] <https://github.com/php/php-src/blob/php-7.3.0/Zend/zend.c#L427>
 [2019-01-01 14:14 UTC] sjon at hortensius dot net
Thanks! I've found another problem - very likely related:

https://3v4l.org/LUq3k

this segfaults, while previously recursion was properly detected
 [2019-01-02 08:47 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=54a58a73805991d3cec927a112965368211b03a5
Log: Fixed bug #77387 (Recursion detection broken when printing GLOBALS)
 [2019-01-02 08:47 UTC] laruence@php.net
-Status: Verified +Status: Closed
 [2019-01-02 08:47 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=384b02d058f2682757a9b03e2384d15bfddec6ac
Log: Fixed bug #77387 (Recursion detection broken when printing GLOBALS)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 16:01:28 2024 UTC