Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12526 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72065 invoked by uid 1010); 1 Sep 2004 13:34:34 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 72013 invoked by uid 1007); 1 Sep 2004 13:34:34 -0000 Message-ID: <20040901133434.71998.qmail@pb1.pair.com> To: internals@lists.php.net References: <4135C8C3.5000705@akbkhome.com> Date: Wed, 1 Sep 2004 15:34:33 +0200 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-Posted-By: 62.58.68.2 Subject: Re: parse errors when testing for undefined exceptions From: r.korving@xit.nl ("Ron Korving") in your function, you should assume sqlite is present. before calling any functions, have one of the first actions in your script (preferably in some file you include always anyway) be a check on the existance of sqlite. problem solved? "Alan Knowles" schreef in bericht news:4135C8C3.5000705@akbkhome.com... > 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