php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65251 array_merge_recursive() recursion detection broken
Submitted: 2013-07-12 13:30 UTC Modified: 2017-01-08 11:02 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: maarten@php.net Assigned: nikic (profile)
Status: Closed Package: Arrays related
PHP Version: 5.5.0 OS:
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: maarten@php.net
New email:
PHP Version: OS:

 

 [2013-07-12 13:30 UTC] maarten@php.net
Description:
------------
<?php
array_merge_recursive$GLOBALS,$GLOBALS)
?>
No longer detects recursion.

It was fixed at the time (https://bugs.php.net/bug.php?id=16064 ) and fix did work until PHP 5.3.26

However PHP 5.4.0 shows a regression, still present in recent 5.4 and 5.5.

See: http://3v4l.org/PfuC8


Test script:
---------------
<?php
array_merge_recursive($GLOBALS,$GLOBALS) 

Expected result:
----------------
Warning: array_merge_recursive(): recursion detected in [...] on line 2

Actual result:
--------------
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 72 bytes) in [...] on line 2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-21 17:01 UTC] arpad@php.net
Broken by rev eea093b4 (fixing #42177)
 [2013-07-22 03:17 UTC] laruence@php.net
-Assigned To: +Assigned To: felipe
 [2017-01-02 14:21 UTC] nikic@php.net
This is fixed in PHP 7.0. Before closing this issue a test should probably be committed.
 [2017-01-02 14:28 UTC] nikic@php.net
-Assigned To: felipe +Assigned To: nikic
 [2017-01-08 11:02 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat May 03 15:01:28 2025 UTC