From: [EMAIL PROTECTED]
Operating system: Windows 2000
PHP version: 4.2.3
PHP Bug Type: Arrays related
Bug description: list() can't get values from associative arrays
list() function can only operate with indexed arrays, but it must also work
with associative arrays, otherwise it can cause confusions.
Take a look at the following example:
<?php
$array1 = array('aaa','bbb','ccc');
$array2 = array('a'=>'aaa','b'=>'bbb','c'=>'ccc');
list($a,$b,$c) = $array1;
echo "$a\n$b\n$c\n";
list($a,$b,$c) = $array2;
echo "$a\n$b\n$c\n";
?>
First list() invocation works well but second one throws notices about
undefined array indexes and don't work at all.
As a workaround it is possible to use:
list() = array_values($array);
but it is not a way to go.
--
Edit bug report at http://bugs.php.net/?id=19930&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=19930&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=19930&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=19930&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=19930&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=19930&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19930&r=support
Expected behavior: http://bugs.php.net/fix.php?id=19930&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=19930&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=19930&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=19930&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=19930&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=19930&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=19930&r=isapi