php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44965 Zend affects on arrays
Submitted: 2008-05-10 21:22 UTC Modified: 2008-05-10 22:23 UTC
From: yektaweb at gmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.2.6 OS: win xp
Private report: No CVE-ID: None
 [2008-05-10 21:22 UTC] yektaweb at gmail dot com
Description:
------------
Zend affects on arrays (PHP Version 5.1.2)

Reproduce code:
---------------
<?php
$fruits = array ("h" => "orange", "b" => "banana", "c" => "apple");

	foreach ($fruits as $value) 
	{
		$my_f = key($fruits);
		echo $my_f . '<br><br>';
		next($fruits);
	}
?>


Expected result:
----------------
h

b

c


Actual result:
--------------
b

b

c


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-10 21:29 UTC] yektaweb at gmail dot com
I am using 
Apache/2.2.0
Zend Optimizer v3.3.0
Zend SG Suite 3.1.0
 [2008-05-10 21:43 UTC] yektaweb at gmail dot com
The following code will not affected by Zend Opt.

foreach ($arr as $key => $value) {
    echo "Key: $key; Value: $value<br />\n";
}
 [2008-05-10 22:19 UTC] crrodriguez at suse dot de
using key() and next() within variables involved in the foreach loop is an undefined operation.

but anyway..

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.
 [2008-05-10 22:23 UTC] derick@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.

.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed May 27 00:01:25 2020 UTC