Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 74621 - PHP 4.3.10 breaks existing applications (foreach broken)
Summary: PHP 4.3.10 breaks existing applications (foreach broken)
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-16 05:45 UTC by Christophe Saout
Modified: 2004-12-16 10:49 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Saout 2004-12-16 05:45:58 UTC
The PHP 4.3.10 foreach function seems to have changed (probably not intentionally, the ChangeLog is speaking of "optimizations" backported from PHP 5).

$array = (
    0 => 'A',
    1 => 'B'
);

foreach($array as $bla) print_r($bla);

returns

Array(0 => 'A', 1 => 0)
Array(0 => 'B', 1 => 1)

instead of

'A'
'B'

This breaks pear (just try to run /usr/bin/pear) and TikiWiki, etc...


Reproducible: Always
Steps to Reproduce:
1. emerge php
2. run pear
3. watch the error messages
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-12-16 10:25:53 UTC
I assume you meant this as your test code:
------
$array = array(
    '0' => 'A',
    '1' => 'B'
);

foreach($array as $bla) print_r($bla);
------

And I do get the correct output of 'AB' on my x86 test box.
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-12-16 10:27:06 UTC
Could you please force the unpack+compile+package stages of the ebuild, then go into $S and run the PHP testcases?
Comment 3 Christophe Saout 2004-12-16 10:39:21 UTC
Just recompiled. Same phenomenon. The test doesn't even begin.

websrv:/var/tmp/portage/php-4.3.10/work/php-4.3.10 # make test

Notice: Array to string conversion in /var/tmp/portage/php-4.3.10/work/php-4.3.10/run-tests.php on line 851
[repeated about 15 times]

=====================================================================
CWD         : /var/tmp/portage/php-4.3.10/work/php-4.3.10
PHP         : /var/tmp/portage/php-4.3.10/work/php-4.3.10/sapi/cli/php
PHP_SAPI    : cli
PHP_VERSION : 4.3.10
ZEND_VERSION: 1.3.0
PHP_OS      : Linux - Linux websrv 2.6.10-rc3-cs1 #1 Tue Dec 14 02:57:14 CET 2004 i686
INI actual  : /etc/php/cli-php4/php.ini
More .INIs  :
Extra dirs  :
=====================================================================

Warning: opendir(/var/tmp/portage/php-4.3.10/work/php-4.3.10/Array): failed to open dir: No such file or directory in /var/tmp/portage/php-4.3.10/work/php-4.3.10/run-tests.php on line 238
ERROR: cannot open directory: /var/tmp/portage/php-4.3.10/work/php-4.3.10/Array
make: [test] Error 1 (ignored)
Comment 4 Christophe Saout 2004-12-16 10:49:42 UTC
Ok, sorry.

When I disable the Zend Optimizer the problem goes away.

I looks like I need a newer version.

Sorry again.