|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-03-06 13:19 UTC] dmitry@php.net
[2007-03-19 19:59 UTC] ashnazg@php.net
[2007-07-14 10:13 UTC] jani@php.net
[2007-07-24 19:26 UTC] dmitry@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 09:00:02 2025 UTC |
Description: ------------ If a global array is assigned to a local variable as in the example, and the local variable is iterated afterwards, the key() function changed the behaviour in the global scope with PHP 5.2.1. Reproduce code: --------------- <?php function foo() { global $arr; $c = $arr["v"]; foreach ($c as $v) {} } $arr["v"] = array("a"); echo "-".key($arr["v"])."-"; // prints "0" foo(); echo "<br/>-".key($arr["v"])."-"; // prints "" since 5.2.1 ("0" on all prior versions) ?> Expected result: ---------------- -0- -0- Actual result: -------------- -0- --