ID: 11389 Updated by: derick Reported By: [EMAIL PROTECTED] Old Status: Critical Status: Open Bug Type: Arrays related Operating System: W98 PHP Version: 4.0.6 New Comment:
It's not critical, cause it does not crash PHP. Previous Comments: ------------------------------------------------------------------------ [2001-11-13 04:04:29] [EMAIL PROTECTED] But this is not the real script!! My real script have a lot of code lines and functions, a lot of arrays inside other arrays and so on, i need 'walk' the arrays, and array_walk crash my code sometimes. To work around this bug, i have written my 'my_array_walk' function in PHP script that always behave OK. I don't need the 'array_walk' function, but i think this bug must be fixed. ------------------------------------------------------------------------ [2001-11-12 18:13:09] [EMAIL PROTECTED] Yes, what happens is that array_walk tries to move forward to the next element by calling zend_hash_move_forward_ex() which determines that the hash is inconsistent and bails out. I think this behavior is good enough. This script is asking for trouble. It's important that people can't crash Apache, but I don't mind if weird scripts like this misbehaves. CVS works okay for me since PHP doesn't crash, but bails out. For me I get the same behavior if I remove the call by references (in array_walk call and myfunc declaration). ------------------------------------------------------------------------ [2001-11-11 21:34:20] [EMAIL PROTECTED] Indeed there is something odd going on: <?php $myarr = array(array(1,2,3), array(1,2,3), array(1,2,3)); echo "before\n"; array_walk($myarr, "myfunc"); function myfunc(&$value, $key) { global $myarr; $myarr=null; } echo "after\n"; ?> This script only echo's "before". --Jani ------------------------------------------------------------------------ [2001-11-11 06:49:53] [EMAIL PROTECTED] Reproduced with 4.2.0-dev (200111080300) on Windows 2000. Array_walk seems to be pretty buggy. There were a few reports of crashes using array_walk, most importantly #12776. Reopening. ------------------------------------------------------------------------ [2001-10-21 01:44:42] [EMAIL PROTECTED] I can not reproduce this with PHP 4.1.0RC1. Could you please try the latest development build from http://www.php4win.com/ ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/?id=11389 Edit this bug report at http://bugs.php.net/?id=11389&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]