#30535 [Com]: Array union (+) doesn't handle array properly
| From: | garak at studenti dot it | Date: | Thu, 23 Dec 2004 15:28:41 +0000 |
| Subject: | #30535 [Com]: Array union (+) doesn't handle array properly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-70982@lists.php.net to get a copy of this message | ||
ID: 30535
Comment by: garak at studenti dot it
Reported By: smadeira at zoominternet dot net
Status: No Feedback
Bug Type: Arrays related
Operating System: Linux 2.4.20-8
PHP Version: 4.3.9
New Comment:
I experience the same problem, with both PHP 4.3.9 and 4.3.10 and Zend
Optimizer 2.5.6 (under Linux)
Previous Comments:
------------------------------------------------------------------------
[2004-10-31 01:00:12] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2004-10-23 13:12:58] derick@php.net
I bet it's a zend optimizer related problem, you could try to install
that on your windows machine and see if the problem occurs then?
------------------------------------------------------------------------
[2004-10-23 13:08:42] smadeira at zoominternet dot net
I don't have the ability to run a Linux snapshot since the account is
hosted. I loaded the code here:
http://kidsportsoftware.com/datebug.php so you
can see it in action.
You can also run phpinfo from here as:
http://kidsportsoftware.com/phpinfo.php to see
how the hosting account
is configured.
I tried a Windows snapshot (4.3.10-dev) and it does work properly on
Windows.
------------------------------------------------------------------------
[2004-10-23 08:22:44] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Can't reproduce - your code produces the very expected result (tried
all dev versions).
------------------------------------------------------------------------
[2004-10-22 21:10:23] smadeira at zoominternet dot net
Description:
------------
The reproduce code will generate an array dump and should have the "[]
=> Zero" as the first element in the array.
I am running php 4.3.9.
configure line is: './configure' '--with-mysql=/usr/local/mysql'
'--with-xml' '--with-curl=../../curl/curl-7.1'
'--with-apache=../../apache/apache_1.3.31' '--with-openssl'
'--with-zlib' '--enable-bcmath' '--enable-calendar'
'--enable-dbx'
'--enable-ftp' '--with-gd' '--with-mcrypt' '--with-mhash'
'--enable-xslt' '--with-xslt-sablot=/usr/local/lib'
'--with-expat-dir=/usr/local' '--with-iconv-dir=/usr/local'
'--with-pear' '--with-jpeg-dir=/usr/lib' '--with-png-dir=/usr/lib'
Reproduce code:
---------------
<?php
$x = array('01'=>'One','02'=>'Two');
$x = array('' => 'Zero') + $x;
print_r($x);
?>
Expected result:
----------------
I am expecting this:
Array ( [] => Zero [01] => One [02] => Two )
If I run this script:
<?php
$x = array('01'=>'One','02'=>'Two');
$y = array('' => 'Zero') + $x;
print_r($y);
?>
I do get the expected result. (Note the use of $y as the union of the
two arrays.)
Actual result:
--------------
Program returns this:
Array ( [01] => One [02] => Two [] => Zero )
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30535&edit=1