Doc #51112 [Opn->Csd]: list() misbehaviour
| From: | nikic@php.net | Date: | Thu, 08 Dec 2011 21:26:56 +0000 |
| Subject: | Doc #51112 [Opn->Csd]: list() misbehaviour | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-7636@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=51112&edit=1
ID: 51112
Updated by: nikic@php.net
Reported by: post at oliver-schieche dot de
Summary: list() misbehaviour
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: Debian (etch)
PHP Version: 5.2.12
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2011-12-08 21:25:26] nikic@php.net
Automatic comment from SVN on behalf of nikic
Revision: http://svn.php.net/viewvc/?view=revision&revision=320698
Log: Fix Doc Bug #51112: list() misbehaviour
Add a warning saying that modification of the array being destructured during list() execution will
result in undefined behavior.
------------------------------------------------------------------------
[2010-03-22 12:00:16] rasmus@php.net
Like Johannes said and Pierre said, writing to a variable you are iterating over
gives undefined behaviour. That means it will work in some cases and not in
others and may very well change between versions. There is nothing to fix here
except perhaps a little note in the documentation.
------------------------------------------------------------------------
[2010-03-22 01:00:29] post at oliver-schieche dot de
Hate to be nagging again, but there's still a problem: it works "as it's supposed
to" (read: "as it's not documented") in PHP4, but doesn't in PHP5 with the
exception, that the following produces expected results:
$a = array('Foo','Bar');
list($a,$b) = $a;
$a == 'Foo' ==> TRUE
$b == 'Bar' ==> TRUE
"both variables are needed during the "list" operation." is a somewhat confusing
statement regarding the issue(s) above.
------------------------------------------------------------------------
[2010-03-21 19:52:00] johannes@php.net
The order in which the variables are picked up in this case is "undefined behavior" - both
variables are needed during the "list" operation.
------------------------------------------------------------------------
[2010-03-18 18:38:12] kalle@php.net
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.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=51112
--
Edit this bug report at https://bugs.php.net/bug.php?id=51112&edit=1