ID: 35511 User updated by: ngaugler at ngworld dot net Reported By: ngaugler at ngworld dot net Status: Bogus Bug Type: Arrays related Operating System: Linux 2.6 PHP Version: 4.4.1 New Comment:
I found it, had to change the wording to look more for next specific functions. http://bugs.php.net/bug.php?id=35444 Previous Comments: ------------------------------------------------------------------------ [2005-12-01 21:15:20] ngaugler at ngworld dot net What is the link to the same bug? I searched many times and was unable to locate one. ------------------------------------------------------------------------ [2005-12-01 20:55:29] [EMAIL PROTECTED] Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. Fixed in CVS months ago. ------------------------------------------------------------------------ [2005-12-01 20:51:49] ngaugler at ngworld dot net Description: ------------ In 4.4.1, when you unserialize an array, then attempt to globalize it within a function, and then pass it to an internal array function such as next or key, it does not work as it was in 4.3.10 or how it functions in PHP 5.0.5. This functions as expected in 4.3.10 and 5.0.5. The documentation clearly states you are not to use next(&array) or key(&array) when using references, which is why this is not used. Reproduce code: --------------- <? $ar = array(array('ID' => 'BOB'), array('ID' => 'GEORGE'), array('ID' => 'JOHN')); $ser = serialize($ar); $arn = unserialize($ser); print_r($arn) . "\n\n"; function breakPHP() { global $arn; for ($i = 0, reset($arn); ($key = key($arn)), (isset($key)); next($arn), $i++) { print "$key ... " . $arn[$key]['ID'] . "<br>\n"; if ($i > 5) { print "we looped"; exit; } } } breakPHP(); ?> Expected result: ---------------- Array ( [0] => Array ( [ID] => BOB ) [1] => Array ( [ID] => GEORGE ) [2] => Array ( [ID] => JOHN ) ) 0 ... BOB<br> 1 ... GEORGE<br> 2 ... JOHN<br> Actual result: -------------- Array ( [0] => Array ( [ID] => BOB ) [1] => Array ( [ID] => GEORGE ) [2] => Array ( [ID] => JOHN ) ) 0 ... BOB<br> 0 ... BOB<br> 0 ... BOB<br> 0 ... BOB<br> 0 ... BOB<br> 0 ... BOB<br> 0 ... BOB<br> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35511&edit=1
