|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43495 array_merge_recursive crash with recursive arrays
Submitted: 2007-12-04 11:25 UTC Modified: 2007-12-05 20:04 UTC
From: Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 5.2.5 OS: any
Private report: No CVE-ID: None
 [2007-12-04 11:25 UTC]
This is basically the same as bug 42752 but in the array_merge_recursive rather than the array_walk recursive code. The fix is the same.

The detection of recursion used in array_merge_recursive is incorrect so it is possible to pass recursive arrays that cause unbounded recursion, leading to stack overflow.

Reproduce code:



array_merge_recursive ($a,$b);
echo "reached the end \n";


Expected result:
reached the end

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-05 20:04 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Dec 10 22:01:27 2023 UTC