Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39499 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14978 invoked from network); 31 Jul 2008 12:06:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jul 2008 12:06:22 -0000 Authentication-Results: pb1.pair.com header.from=johannes@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 83.243.58.163 as permitted sender) X-PHP-List-Original-Sender: johannes@php.net X-Host-Fingerprint: 83.243.58.163 mail4.netbeat.de Received: from [83.243.58.163] ([83.243.58.163:48978] helo=mail4.netbeat.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/4B-60033-DBAA1984 for ; Thu, 31 Jul 2008 08:06:22 -0400 Received: (qmail 20120 invoked by uid 507); 31 Jul 2008 12:06:18 -0000 Received: from ppp-88-217-23-214.dynamic.mnet-online.de (HELO ?192.168.1.101?) (postmaster%schlueters.de@88.217.23.214) by mail4.netbeat.de with ESMTPA; 31 Jul 2008 12:06:18 -0000 To: Matt Wilmas Cc: internals@lists.php.net, Lukas Kahwe Smith In-Reply-To: <01b401c8ec13$28cd3510$0201a8c0@pc1> References: <01b401c8ec13$28cd3510$0201a8c0@pc1> Content-Type: text/plain Date: Thu, 31 Jul 2008 14:06:16 +0200 Message-ID: <1217505976.5408.34.camel@goldfinger.johannes.nop> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 (2.22.3.1-1.fc9) Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] New functions: array_replace[_recursive] From: johannes@php.net (Johannes =?ISO-8859-1?Q?Schl=FCter?=) 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