|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-10-02 10:05 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 04:00:01 2025 UTC |
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