#42177 [NEW]: Warning "array_merge_recursive(): recursion detected" comes again...
| From: | rl at ez dot no | Date: | Thu, 02 Aug 2007 12:24:08 +0000 |
| Subject: | #42177 [NEW]: Warning "array_merge_recursive(): recursion detected" comes again... | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-115676@lists.php.net to get a copy of this message | ||
From: rl at ez dot no
Operating system: linux mandriva 2006
PHP version: 4.4.7
PHP Bug Type: Arrays related
Bug description: Warning "array_merge_recursive(): recursion detected" comes again...
Description:
------------
Just run the code below and please answer the question:
Why those marked as 'warning' generate warning "array_merge_recursive():
recursion detected" while others marked as 'clear' do not?
<?
// clear
echo "<br>example 1";
$a1 = array( 'a' => 1, 'b' => 2 );
$az = array_merge_recursive( $a1, $a1 );
unset( $a1, $a2 );
// clear
echo "<br>example 2";
$a1 = array( 'key1' => 1, 'key3' => 2 );
$a2 = $a1;
$az = array_merge_recursive( $a1, $a2 );
unset( $a1, $a2 );
// clear
echo "<br>example 3";
$a1 = array( 'key1' => 1, 'key3' => 2 );
$a2 = & $a1;
$az = array_merge_recursive( $a1, $a2 );
unset( $a1, $a2 );
// warning
echo "<br>example 4";
$a1 = array( 'key1' => 1, 'key3' => 2 );
$a2 = & $a1;
$a3 = $a1;
$az = array_merge_recursive( $a1, $a2 );
unset( $a1, $a2 );
// warning
echo "<br>example 5";
$a1 = array( 'key1' => 1, 'key3' => 2 );
$a2 = & $a1;
$a3 = $a2;
$az = array_merge_recursive( $a1, $a2 );
unset( $a1, $a2 );
// warning
echo "<br>example 6";
$a1 = array( 'key1' => 1, 'key3' => 2 );
$a2 = $a1;
$a2[] = 3; // $a2['c'] = 3; - no matter, warning anyway
$az = array_merge_recursive( $a1, $a2 );
unset( $a1, $a2 );
// clear
echo "<br>example 7";
$a1 = array( 'key1' => 1, 'key3' => 2 );
$a2 = & $a1;
$a2[] = 3;
$az = array_merge_recursive( $a1, $a2 );
unset( $a1, $a2 );
// warning
echo "<br>example 8";
$a1 = array( 'key1' => 1, 'key3' => 2 );
$a2 = & $a1;
$a3 = $a2;
$az = array_merge_recursive( $a1, $a3 );
unset( $a1, $a2, $a3 );
// warning
echo "<br>example 9";
$a1 = array( 'key1' => 1, 'key3' => 2 );
$a2 = $a1;
$a3 = & $a2;
$az = array_merge_recursive( $a1, $a3 );
unset( $a1, $a2, $a3 );
// clear
echo "<br>example 10";
$a1 = array( 'key1' => 1, 'key3' => 2 );
$a2 = & $a1;
$a3 = & $a2;
$az = array_merge_recursive( $a1, $a3 );
unset( $a1, $a2, $a3 );
// warning
echo "<br>example 11";
$a1 = array( 'key1' => 1, 'key3' => 2 );
$a2 = $a1;
$a3 = $a2;
$a3[] = 3;
$az = array_merge_recursive( $a1, $a3 );
unset( $a1, $a2, $a3 );
// clear
echo "<br>example 12";
$a1 = array( 'key1' => 1, 'key3' => 2 );
$a2 = & $a1;
$a3 = & $a2;
$a3[] = 3;
$az = array_merge_recursive( $a1, $a3 );
unset( $a1, $a2, $a3 );
?>
--
Edit bug report at http://bugs.php.net/?id=42177&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42177&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42177&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42177&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42177&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=42177&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42177&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42177&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42177&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42177&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42177&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=42177&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=42177&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42177&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42177&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42177&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42177&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42177&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42177&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42177&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42177&r=mysqlcfg