php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31153 foreach strange result
Submitted: 2004-12-17 15:24 UTC Modified: 2004-12-17 15:29 UTC
From: andrea dot busia at axis-sv dot it Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.3.10 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: andrea dot busia at axis-sv dot it
New email:
PHP Version: OS:

 

 [2004-12-17 15:24 UTC] andrea dot busia at axis-sv dot it
Description:
------------
When I use foreach on an array the values are wrong. It's very critical.


Reproduce code:
---------------
<?
$a=array(5,10,15);
foreach($a as $b) var_dump($b);
?>

Expected result:
----------------
int(5)
int(10)
int(15)

Actual result:
--------------
array(2) {
  [0]=>
  int(5)
  [1]=>
  int(0)
}
array(2) {
  [0]=>
  int(10)
  [1]=>
  int(1)
}
array(2) {
  [0]=>
  int(15)
  [1]=>
  int(2)
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-17 15:29 UTC] edink@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.

Update ZendOptimizer and the problem will go away.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 16 19:01:32 2024 UTC