From: eli dot hen at gmail dot com
Operating system: unix / windows
PHP version: 5.0.2
PHP Bug Type: Arrays related
Bug description: array + operator with Zend Optimizer
Description:
------------
Hi,
It seems that + operator on arrays seems to be incorrect with Zend
Optimizer (tested on v2.5.7 using PHP5.0.2 on CGI/CLI mode rather on unix
or windows platforms).
The manual regarding array + operator only talks about adding array
*variables*, and not the form in the example above.
Please note that if you assign the value of array(..)+$a into another
variable (not $a), then you get the expected result.
-thanks, Eli
Reproduce code:
---------------
<?php
$a=array('b'=>2,'c'=>3);
$a=array('a'=>1)+$a;
var_dump($a);
?>
Expected result:
----------------
array(3) {
["a"]=>
int(1)
["b"]=>
int(2)
["c"]=>
int(3)
}
Actual result:
--------------
array(3) {
["b"]=>
int(2)
["c"]=>
int(3)
["a"]=>
int(1)
}
--
Edit bug report at http://bugs.php.net/?id=32057&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32057&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32057&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32057&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32057&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32057&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32057&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32057&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32057&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32057&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32057&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32057&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32057&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32057&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32057&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32057&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32057&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32057&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32057&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32057&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32057&r=mysqlcfg