php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32057 array + operator with Zend Optimizer
Submitted: 2005-02-21 21:59 UTC Modified: 2005-02-21 22:05 UTC
From: eli dot hen at gmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.0.2 OS: unix / windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: eli dot hen at gmail dot com
New email:
PHP Version: OS:

 

 [2005-02-21 21:59 UTC] eli dot hen at gmail dot com
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)
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-21 22:05 UTC] johannes@php.net
Do not file bugs when you have Zend extensions (zend_extension=)
loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
APC, Xdebug and ionCube loader.  These extensions often modify engine
behavior which is not related to PHP itself.

Tell the Zend guys... 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC