From:
Operating system: linux,windows
PHP version: 5.3.2
Package: Variables related
Bug Type: Bug
Bug description:list() fails under a mere condition
Description:
------------
let $b=array(# , #).
then
list($a,$b) = $b
fails.
moar precise: after the assigment we'd get
$b = $b[1],
$a = {
$b[1][0], if $b[1] is a string/array
NULL, if $b[1] is a number
}
if $b[1] is an object we'd get a fatal error 'cant convert object->array'.
//////////////////
it works correctly if we try list($b,$a)=$b. so an easy fix could be forged
in just 2 additional steps: swap arguments * do the usual work * swap
results
Test script:
---------------
$a = 1;
$b = array('ohno','yeah');
list($a,$b) = $b;
print_r(array('a'=>$a,'b'=>$b));
Expected result:
----------------
Array
(
[a] => ohno
[b] => yeah
)
Actual result:
--------------
Array
(
[a] => y
[b] => yeah
)
--
Edit bug report at http://bugs.php.net/bug.php?id=52321&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52321&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52321&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52321&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52321&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52321&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52321&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52321&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52321&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52321&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52321&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52321&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52321&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52321&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52321&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52321&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52321&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52321&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52321&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52321&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52321&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52321&r=mysqlcfg