|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-10-12 22:14 UTC] name at email dot com
Description:
------------
Calling array_merge_recursive() produces an unclear warning ("recursion detected in"...) and seems to be breaking the script. The above happens if two conditions are met:
1. there is a private/protected data member in the object (see code).
2. the merged arrays contain at least one same string as key.
* please note: following code reproduces this problem on the latest snaps of both 5.2.6 and 5.3
Reproduce code:
---------------
class A {
private $variable;
public function __construct() {
$this->variable = 'foo';
}
}
$x = new A;
$b = array_merge_recursive(array("name"=>$x),array("name"=>$x));
var_dump($b);
Expected result:
----------------
see 'Actual result' below...
Actual result:
--------------
array(1) {
["name"]=>
array(1) {
["�A�variable"]=>
array(2) {
[0]=>
string(3) "foo"
[1]=>
string(3) "foo"
}
}
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 01:00:01 2025 UTC |
@jani PHP Version 5.2.7RC4-dev Build Date Nov 17 2008 11:39:11 array(1) { ["name"]=> array(1) { ["�A�variable"]=> array(2) { [0]=> string(3) "foo" [1]=> string(3) "foo" } } }