Edit report at http://bugs.php.net/bug.php?id=51112&edit=1

 ID:               51112
 Updated by:       ka...@php.net
 Reported by:      post at oliver-schieche dot de
 Summary:          list() misbehaviour
 Status:           Open
 Type:             Documentation Problem
-Package:          Documentation problem
+Package:          Scripting Engine problem
 Operating System: Debian (etch)
 PHP Version:      5.2.12

 New Comment:

Can this either be classfied as a scripting engine bug. If it indeed is
a documentation issue then re-classify this as a "To be Documented"
documentation issue for the developer that picks this one up.


Previous Comments:
------------------------------------------------------------------------
[2010-02-22 12:58:56] post at oliver-schieche dot de

Why document an obvious bug instead of fixing it? How would you
document/explain this?



If this works:



    function ret($array) {return $array;}

    $b = array('foo','bar');

    list($a,$b) = ret($b);



But this doesn't:



    function &ret(&$array) {return $array;}

    $b = array('foo','bar');

    list($a,$b) = ret($b);



Then there's a referencing error hidden somewhere...

------------------------------------------------------------------------
[2010-02-22 12:42:52] paj...@php.net

That's pretty much the same thing you can see with foreach, the array
should not be altered while looping (the array itself, the data of a
given element can be altered). No bug here, but should be documented.

------------------------------------------------------------------------
[2010-02-22 12:38:52] post at oliver-schieche dot de

Description:
------------
When assigning an array to a list() of variables and using the input
array as a member of that list(), unexpected results are returned.

Reproduce code:
---------------
$b = array('foo','bar');

list($a,$b) = $b;



$c = array('foo','bar');

list($c,$d) = $c;

Expected result:
----------------
$a == $c == 'foo'

$b == $d == 'bar'

Actual result:
--------------
$a == 'b'

$b == 'bar'



$c == 'foo'

$d == 'bar'


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51112&edit=1

Reply via email to