ID:               42752
 Updated by:       [EMAIL PROTECTED]
 Reported By:      rob_nicholson at uk dot ibm dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Reproducible crash
 Operating System: windows XP, Ubuntu
 PHP Version:      6CVS-2007-09-25 (snap)
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




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

[2007-09-25 07:27:16] rob_nicholson at uk dot ibm dot com

Description:
------------
array_walk_recursive contains code to detect recursion in arrays where
the recursion depth is 1. But deeper recursion is not detected, leading
to the code recursing until the stack depth becomes too great and a
crash occurs.

It seems clear from the code that the problem is in php_array_walk in
ext/standard/array.c. The following test only detects single level
recursion:

                        if (thash == target_hash) {
                               php_error_docref(NULL TSRMLS_CC,
E_WARNING, "recursion detected");
                                 return 0;
                         }

Reproduce code:
---------------
<?php
function myfunc($value,$key) { echo "value: $value, key: $key \n";}
$a=array(array(),"foo"=>"bar");
$a[0][]=&$a;
array_walk_recursive($a,"myfunc");
echo "reached end \n";
?>

Expected result:
----------------
value: bar, key: foo
reached end

Actual result:
--------------
Segmentation fault



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


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

Reply via email to