From: ktk at bigfoot dot com
Operating system: GNU/Linux
PHP version: 5.1.1
PHP Bug Type: Arrays related
Bug description: Failure on list($a, $b) = $b
Description:
------------
In PHP 5.1 the list() operator fails to correctly assign values to
variables that appear left of the variable that is used as the source
array, if the source variable is itself listed as one of the variables to
be assigned.
list($a, $b) = $b; fails to properly assign $a.
PHP 5.0 and earlier have no problem with this syntax.
Reproduce code:
---------------
$c = array("Apple", "Banana", "Pear", "Grape", "Orange");
list($a, $b, $c, $d, $e) = $c;
var_dump($a);
var_dump($b);
var_dump($c);
var_dump($d);
var_dump($e);
Expected result:
----------------
string(5) "Apple"
string(6) "Banana"
string(4) "Pear"
string(5) "Grape"
string(6) "Orange"
Actual result:
--------------
string(1) "P"
string(1) "e"
string(4) "Pear"
string(5) "Grape"
string(6) "Orange"
--
Edit bug report at http://bugs.php.net/?id=35560&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=35560&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=35560&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=35560&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=35560&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=35560&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35560&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35560&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35560&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35560&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35560&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=35560&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=35560&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35560&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35560&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35560&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35560&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35560&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35560&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35560&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35560&r=mysqlcfg