PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #30914 foreach returns the wrong value
Submitted:26 Nov 2004 4:02pm UTC Modified: 26 Nov 2004 4:25pm UTC
From:phpbug at billmann-edv dot net Assigned to:
Status:Bogus Category:Arrays related
Version:4.3.10RC1 OS:Linux
View/Vote Developer Edit Submission

[26 Nov 2004 4:02pm UTC] phpbug at billmann-edv dot net
Description:
------------
foreach returns the wrong results. Taking a look at the simple example
code and the result should make any more explanations unnecessary...
;-)

Reproduce code:
---------------
foreach ( array ( 1 ) as $data ) {
  var_dump ( $data );
}

Expected result:
----------------
int(1)

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

[26 Nov 2004 4:12pm UTC] derick@php.net
This works fine here, do you use any accelerator or cache?
[26 Nov 2004 4:18pm UTC] phpbug at billmann-edv dot net
ok, I just realized that this only happens when you use the
ZendOptimizer 2.5.5. Without it and with the new version 2.5.7 it works
like expected...
Sorry for the noise ;-)
[26 Nov 2004 4:25pm UTC] derick@php.net
Not a bug in PHP -> bogus.

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC