php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31143 foreach does not set value variable
Submitted: 2004-12-17 07:51 UTC Modified: 2004-12-17 08:42 UTC
From: tabacco at adventuregamers dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.10 OS: RH EL3 Kernel 2.4.21-20.0.1.EL
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tabacco at adventuregamers dot com
New email:
PHP Version: OS:

 

 [2004-12-17 07:51 UTC] tabacco at adventuregamers dot com
Description:
------------
When I upgraded to 4.3.10 from 4.3.9, every piece of code on my site that used foreach() broke.  As near as I can tell, in foreach($array as $value), $value wasn't being set.  I uninstalled 4.3.10 and reinstalled 4.3.9 and it works beautifully again.  I used the same php.ini all three times.

Reproduce code:
---------------
<?php
$test_arr = array(1,2,3,4,5);

foreach($test_arr as $number) {

   echo $number;

}
?>

Expected result:
----------------
It should print:

12345

Actual result:
--------------
It prints nothing, and isset($number) returns FALSE.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-17 08:18 UTC] tabacco at adventuregamers dot com
Okay, apologies, aparently I'm an idiot.  The $value variable is set, but it's an array.  I wrote up the bug after fixing everything, so I had to guess at expected output.  Based on a couple of notificatation e-mails generated during the downtime, the test code given would actually print:

ArrayArrayArrayArrayArray.
 [2004-12-17 08:42 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-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 23 18:01:29 2024 UTC