Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12532 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24362 invoked by uid 1010); 1 Sep 2004 20:04:28 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 98453 invoked from network); 1 Sep 2004 19:58:32 -0000 Received: from unknown (HELO jan.prima.de) (83.97.50.139) by pb1.pair.com with SMTP; 1 Sep 2004 19:58:32 -0000 Received: from BAUMBART (p508EB85E.dip.t-dialin.net [::ffff:80.142.184.94]) (IDENT: HydraIRC, AUTH: LOGIN tobi) by jan.prima.de with esmtp; Wed, 01 Sep 2004 19:58:31 +0000 Date: Wed, 1 Sep 2004 21:56:25 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1031672452.20040901215625@marcus-boerger.de> To: Alan Knowles CC: internals@lists.php.net In-Reply-To: <4135C8C3.5000705@akbkhome.com> References: <4135C8C3.5000705@akbkhome.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] parse errors when testing for undefined exceptions From: helly@php.net (Marcus Boerger) Hello Alan, juts for the record, you can even __autoload the missing exception class: php -n -r 'function __autoload($n) { var_dump($n); eval("class $n extends Exception {}"); } try { } catch(ExcetpionXYZ $e) {};' and besides what should the compiler do? Guess what that exception you specified might be? That's like expecting functions were present of the not loaded extension... regrads marcus Wednesday, September 1, 2004, 3:04:03 PM, you wrote: > This is a simple example of why making a parse error out of undefined > Exception types is going to be very problematic. > function test($a) { > if (!extension_exists('sqlite')) { > return; > } > try { > SQLite::query($a); > // parse error!!! - if we dont have sqlite, we dont have SQLite > exception! > } catch(SQLite_Exception $e) { > echo "problem with query"; > return; > } > } > This has a big knock on effect that we can not lazy load Exception > definitions, even if they are only used in Exceptional situations. (its > pretty much the same issue as instanceof - forcing the loading of code, > that may never be used, except to test it's non-existance.) > Regards > Alan -- Best regards, Marcus mailto:helly@php.net