ID: 40509 Updated by: [EMAIL PROTECTED] Reported By: alex dot killing at gmx dot de -Status: Open +Status: Assigned Bug Type: Arrays related Operating System: MaxOsX/RedHat PHP Version: 5.2.1 -Assigned To: +Assigned To: dmitry
Previous Comments: ------------------------------------------------------------------------ [2007-02-16 15:24:36] alex dot killing at gmx dot de 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- -- ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40509&edit=1