|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-08-23 15:37 UTC] laruence@php.net
-Status: Open
+Status: Not a bug
[2012-08-23 15:37 UTC] laruence@php.net
[2012-08-24 01:27 UTC] david at grudl dot com
[2012-08-24 02:51 UTC] laruence@php.net
[2012-09-13 01:51 UTC] david at grudl dot com
[2012-09-13 02:44 UTC] laruence@php.net
[2012-09-13 02:45 UTC] laruence@php.net
[2012-09-13 16:19 UTC] nikic@php.net
[2012-09-13 16:19 UTC] nikic@php.net
-Status: Not a bug
+Status: Re-Opened
[2012-09-14 02:56 UTC] laruence@php.net
-Assigned To:
+Assigned To: laruence
[2012-09-14 02:56 UTC] laruence@php.net
[2012-09-14 03:00 UTC] laruence@php.net
-Status: Re-Opened
+Status: Assigned
[2015-06-10 13:37 UTC] arjen at react dot com
[2017-01-31 11:00 UTC] nikic@php.net
-Status: Assigned
+Status: Closed
[2017-01-31 11:00 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 07:00:02 2025 UTC |
Description: ------------ Foreach unexpectedly advances the internal array pointer, although array is returned by function without reference. Test script: --------------- <?php class Test { function run() { $this->arr = array('item'); var_dump(key($this->arr)); // dumps 0 // this unexpectedly advances the internal array pointer foreach ($this->getArr() as $v) {} var_dump(key($this->arr)); // dumps NULL } function getArr() { // is NOT returned by reference return $this->arr; } } $test = new Test; $test->run(); Expected result: ---------------- It dumps "0" in second time too.