|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-11-04 09:03 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 17 15:00:01 2025 UTC |
Description: ------------ Array internal pointer does't work propely when passed to a function by reference. Reproduce code: --------------- $t = array('firstName' => 'Yanik', 'lastName' => 'Lupien'); // Cause an infinit loop, always display first key function test(&$t) { for(reset($t); !is_null($key = key($t)); next($t)) { print "{$key}<br/>"; } } //Work well for(reset($t); !is_null($key = key($t)); next($t)) { print "{$key}<br/>"; } // Infinit loop test($t); Expected result: ---------------- firstName lastName firstName lastName Actual result: -------------- firstName lastName firstName firstName firstName firstName firstName firstName ...