#51112 [Opn]: list() misbehaviour

From: Date: Mon, 22 Feb 2010 12:42:52 +0000
Subject: #51112 [Opn]: list() misbehaviour
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3955@lists.php.net to get a copy of this message
ID: 51112 Updated by: pajoye@php.net Reported By: post at oliver-schieche dot de Status: Open -Bug Type: Scripting Engine problem +Bug Type: Documentation problem Operating System: Debian (etch) PHP Version: 5.2.12 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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/?id=51112&edit=1

« previous php.doc.bugs (#3955) next »