ID:               11389
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Analyzed
 Bug Type:         Arrays related
-Operating System: W98
+Operating System: ALL
-PHP Version:      4.0.6
+PHP Version:      4.2.0-dev
 New Comment:

I know array walk has problem, but it's not simple to fix....


Previous Comments:
------------------------------------------------------------------------

[2001-11-16 02:52:01] [EMAIL PROTECTED]

It's not critical, cause it does not crash PHP.

------------------------------------------------------------------------

[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.

------------------------------------------------------------------------

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/11389

-- 
Edit this bug report at http://bugs.php.net/?id=11389&edit=1

Reply via email to