Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9731 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95417 invoked by uid 1010); 8 May 2004 09:59:01 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 95393 invoked from network); 8 May 2004 09:59:01 -0000 Received: from unknown (HELO basiczlager.backendmedia.com) (195.75.116.242) by pb1.pair.com with SMTP; 8 May 2004 09:59:01 -0000 Received: from localhost (localhost [127.0.0.1]) by basiczlager.backendmedia.com (Postfix) with ESMTP id 4889782ED5 for ; Sat, 8 May 2004 11:59:05 +0200 (CEST) Received: from basiczlager.backendmedia.com ([127.0.0.1]) by localhost (basiczlager [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 09661-06 for ; Sat, 8 May 2004 11:59:00 +0200 (CEST) Received: from backendmedia.com (p213.54.194.14.tisdip.tiscali.de [213.54.194.14]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by basiczlager.backendmedia.com (Postfix) with ESMTP id 1DE0C82EC0 for ; Sat, 8 May 2004 11:59:00 +0200 (CEST) Message-ID: <409CAEC8.7000103@backendmedia.com> Date: Sat, 08 May 2004 11:56:24 +0200 Organization: BackendMedia GbR User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PHP Developers Mailing List Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by somedaemon at backendmedia.com Subject: throwing an exception on failed require From: smith@backendmedia.com (Lukas Smith) Hi, I think it would be useful if require would throw an exception on failure. Currently one would use @include in order to load in a file that could be missing or could contain parse errors. However it is impossible to easy find out if the file was missing, had parse errors or returned false. Please also note that file_exists() doesnt check the include path and a check like this also opens up the chance for race conditions etc. By throwing an exception inside require with the necessary information it would be able to cleanly handle this situation without having to silence this error and then parsing the error message. And it would obviously be BC compatible as uncaught exceptions are fatal. regards, Lukas Smith