Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4610 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53105 invoked by uid 1010); 30 Sep 2003 10:33:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 53066 invoked from network); 30 Sep 2003 10:33:57 -0000 Received: from unknown (HELO mail.dybnet.de) (195.75.116.242) by pb1.pair.com with SMTP; 30 Sep 2003 10:33:57 -0000 Received: (qmail 19148 invoked by uid 508); 30 Sep 2003 10:31:30 -0000 Received: from unknown (HELO vandal) (vandal@212.202.39.136) by www.dybnet.de with RC4-MD5 encrypted SMTP; 30 Sep 2003 10:31:30 -0000 To: Date: Tue, 30 Sep 2003 12:32:59 +0200 Organization: BackendMedia GbR Message-ID: <005801c3873e$38c71880$4d00a8c0@vandal> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Subject: file_exists and array_merge_clobber From: smith@backendmedia.com ("Lukas Smith") Hi, We have a new intern who got right to work to improve file_exists() to also be able to check the include_path similar to how fopen() can. We have a patch here. Due to some issues on the CVS version of ext/standard/filestat.c in HEAD we commented out some code in the file in order to be able to compile. This is not really needed for our patch of course. You can find the patch here: http://www.backendmedia.com/php_patches/file_exists.patch Since neither my intern nor I have previous experience in modifying the PHP source we would obviously appreciate any hints. We were especially unsure how much we need to check the parameter values ourselves. We also plan to create a new array function based on a user suggestion in the user comments of array_merge_recursive(). Here is an implementation in PHP (I modified it a bit this morning without testing it in much detail, so hopefully it works as I have planned it). Essentially I need this in a bunch of PEAR classes to be able to handle multidimensional option arrays that need to overwrite a default array. function array_merge_clobber($a1, $a2) { if (!is_array($a1) || !is_array($a2)) { return false; } foreach($a2 as $key => $val) { if (is_array($val) && isset($a1[$key]) && is_array($a1[$key]) ) { $a1[$key] = array_merge_clobber($a1[$key], $val); } else { $a1[$key] = $val; } } return $a1; } Dunno if the name is all that good though :-) regards, Lukas Smith smith@backendmedia.com _______________________________ BackendMedia www.backendmedia.com berlin@backendmedia.com Linn Zwoch Smith GbR Pariser Str. 44 D-10707 Berlin Tel +49 30 83 22 50 00 Fax +49 30 83 22 50 07