Re: [PATCH] New functions: array_replace[_recursive]

From: Date: Thu, 31 Jul 2008 12:06:16 +0000
Subject: Re: [PATCH] New functions: array_replace[_recursive]
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-39499@lists.php.net to get a copy of this message
Matt, On Tue, 2008-07-22 at 10:52 -0500, Matt Wilmas wrote: > Adding these two array functions has been on the TODO for a while, The patch can quite easily be tricked into an endless recursion of php_array_replace_recursive() calls which will segfault: $ php -r '$a = array(); $a[] = &$a; $b = array(); $b[] = &$b; array_replace_recursive($a, $b);' Segmentation fault Some other cases were covered by PHP's recursion detection: $ php -r '$a = array(); $a[1] = &$a; $b = array(); $b[2] = &$b; array_replace_recursive($a, $b, array(&$a, &$b), array(&$b, &$a));' Warning: array_replace_recursive(): recursion detected in Command line code on line 1 Can you try to add a detection for the first case? johannes

« previous php.internals (#39499) next »