ID:               40608
 Updated by:       [EMAIL PROTECTED]
 Reported By:      eric dot broersma at phil dot uu dot nl
-Status:           Open
+Status:           Feedback
 Bug Type:         Arrays related
 Operating System: Sun Solaris
 PHP Version:      5.2.1
 New Comment:

We would gladly revisit it, but your reproduce code works perfectly
fine on Linux i386, Linux x86, Linux PPC, Solaris/SPARC, AIX/PPC and
MacOS.


Previous Comments:
------------------------------------------------------------------------

[2007-03-19 18:51:05] [EMAIL PROTECTED]

That was supposed to read:

"I am running a vanilla compilation of PHP 5.2.1"

"I first encountered the issue while running PhpDocumentor
v1.3.1 on PHP v5.2.1"

------------------------------------------------------------------------

[2007-03-19 18:47:25] [EMAIL PROTECTED]

I am experiencing this problem using PHP v5.2.1, exactly as described,
whereas it works as described in v5.2.0.

I am running a vanilla compilation of PHP 5.2.0 (./configure, make,
make install) with no compiler options added.  I'm running it on WinXP
via Cygwin.  I first encountered the issue while running PhpDocumentor
v1.3.1 on PHP v5.2.0, where PhpDocumentor's code has a function
containing an inner foreach (inside an outer foreach) that is returning
explicitly to the caller.  This function is being called from inside a
foreach in the main code.  The array that is being iterated through in
the caller's foreach is being passed to the function, and in the
function that same array is being iterated through by the inner foreach.
 This also results in an infinite loop.  What I see happening is that
the array counter in the innermost foreach is reaching the end and then
inexplicably jumping back to "3".

During discussion on the bug file against PhpDocumentor (PEAR #10289),
this particular PHP code change was discovered and considered a possible
culprit: 
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?annotate=1.647.2.27.2.26#l3791


It was considered suspect due to the explicit subtraction of "3", too
much of a coincidence with the behavior seen in PhpDocumentor.

Just to help rule out PhpDocumentor code itself, please realize that
the same PhpDoc code runs fine on all PHP versions prior to v5.2.1 that
I tested it on (5.2.0, 5.1.6, 4.4.6, 4.4.5, 4.4.4, 4.4.2).

Since this was "closed" due to no feedback, rather than being a
duplicate or actually fixed, I'm reopening it so the PHP developers can
revisit it based on my additional info.

------------------------------------------------------------------------

[2007-03-03 01:00:00] 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".

------------------------------------------------------------------------

[2007-02-23 20:56:28] [EMAIL PROTECTED]

Cannot reproduce.
Make sure you don't have any zend_extension's like ionCube, Zend
Optimizer, APC, eAccelerator etc.

------------------------------------------------------------------------

[2007-02-23 16:49:12] eric dot broersma at phil dot uu dot nl

Description:
------------
A break within a foreach construct may cause an infinite loop when the
foreach construct is nested within another foreach construct, possibly
as a result of the internal array pointer of the array being foreach'ed
not being reset.

This problem did not occur in PHP 5.0.5, but did occur in PHP 5.2.1.

Reproduce code:
---------------
$w = array ( 0, 1 );

echo 'a';
foreach ( $w as $x ) {          
        echo 'b' . $x;
        foreach ( $w as $z ) {
                echo 'c' . $z;
                break 1;
        }               
        echo 'e' . $x;
}       
echo 'f';

Expected result:
----------------
ab0c0e0b1c0e1f


(Behaviour in PHP 5.0.5)

Actual result:
--------------
ab0c0e0b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0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e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b2c0e2b1c0e1b...
(infinite loop)

(Behaviour in PHP 5.2.1)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40608&edit=1

Reply via email to