|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-11-15 19:16 UTC] felipe@php.net
-Package: Scripting Engine problem
+Package: Documentation problem
[2012-04-11 12:40 UTC] nikic@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: nikic
[2012-04-11 12:40 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 11 16:00:01 2025 UTC |
Description: ------------ When a parameter to list() and the variable assigned to it are the same (that means list(...,$a)=$a;), list() uses the new value of the variable (once it's been overwritten) and reads the remaining parameters from this new value. This is surprising and undocumented behaviour. It would be better if list() kept assigning values from the originally assigned array. The problem exists in PHP 5.3.2-2 too. This is not important, just surprising. Array variables usually get named distinctly from other variables, so the conflict doesn't surface often. Test script: --------------- $n=array("b","#123"); list($b,$n)=$n; // Currently equivalent to "$n=$n[1]; $b=$n[0];" echo $b; Expected result: ---------------- b Actual result: -------------- #