#46649 [NEW]: Setting array element with that same array produces inconsistent results
| From: | binarysurgeon at gmail dot com | Date: | Sat, 22 Nov 2008 23:08:36 +0000 |
| Subject: | #46649 [NEW]: Setting array element with that same array produces inconsistent results | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-131214@lists.php.net to get a copy of this message | ||
From: binarysurgeon at gmail dot com
Operating system: Linux 2.6
PHP version: 5.2.6
PHP Bug Type: *General Issues
Bug description: Setting array element with that same array produces inconsistent results
Description:
------------
When setting an a particular array element to the array itself, results
are different when it's inside a function vs outside the function.
Reproduce code:
---------------
function func()
{
$a[1] = '1';
$a[0] = $a;
var_dump($a);
}
func();
$a[1] = '1';
$a[0] = $a;
var_dump($a);
Expected result:
----------------
I'm not sure what to expect but at the vary least, the results should be
consistent. Results were consistent in 5.2.1.
array(2) {
[1]=>
string(1) "1"
[0]=>
array(1) {
[1]=>
string(1) "1"
}
}
array(2) {
[1]=>
string(1) "1"
[0]=>
array(1) {
[1]=>
string(1) "1"
}
}
Actual result:
--------------
array(2) {
[1]=>
string(1) "1"
[0]=>
NULL
}
array(2) {
[1]=>
string(1) "1"
[0]=>
array(1) {
[1]=>
string(1) "1"
}
}
--
Edit bug report at http://bugs.php.net/?id=46649&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46649&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46649&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46649&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46649&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46649&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=46649&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46649&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46649&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46649&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46649&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46649&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46649&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46649&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46649&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46649&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46649&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46649&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46649&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46649&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46649&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46649&r=mysqlcfg