From:             web at developer dot bg
Operating system: Windows2000 Adv Server
PHP version:      4.3.2
PHP Bug Type:     Unknown/Other Function
Bug description:  each() seems to return BOOL instead of ARRAY

Description:
------------
Under certain circumstances a variable storing the result of each()
contains the boolean TRUE instead of the array or FALSE that is normaly
expected.

The code will give you an idea what exactly is the problem.

Reproduce code:
---------------
$arr = array('apple', 'banana', 'strawberry', 'pineapple', 'orange');
$i = 0;
while($fruit=each($arr) || $i>=3)
 {
 echo $fruit[value].'<br>';
 $i++;
 }

Expected result:
----------------
apple
banana
strawberry

Actual result:
--------------
1
1
1

-- 
Edit bug report at http://bugs.php.net/?id=24754&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24754&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24754&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=24754&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24754&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24754&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24754&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24754&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24754&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24754&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24754&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24754&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24754&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24754&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24754&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24754&r=gnused

Reply via email to