Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17600 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92597 invoked by uid 1010); 8 Aug 2005 13:01:16 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 92582 invoked from network); 8 Aug 2005 13:01:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2005 13:01:16 -0000 X-Host-Fingerprint: 217.160.181.63 php-applications.de Received: from ([217.160.181.63:57648] helo=smtp.php-applications.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id E6/8A-04646-B9757F24 for ; Mon, 08 Aug 2005 09:01:16 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.php-applications.de (PostfixSMTP on php-applications.de) with ESMTP id 83BB54000DC; Mon, 8 Aug 2005 15:01:16 +0200 (CEST) Received: from smtp.php-applications.de ([127.0.0.1]) by localhost (php-applications.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05050-08; Mon, 8 Aug 2005 15:01:09 +0200 (CEST) Received: from [10.0.2.167] (stalker.ez.no [194.248.150.2]) by smtp.php-applications.de (PostfixSMTP on php-applications.de) with ESMTP id C5C4B401D52; Mon, 8 Aug 2005 15:01:08 +0200 (CEST) Message-ID: <42F75FA0.6090404@schlitt.info> Date: Mon, 08 Aug 2005 15:35:28 +0200 Reply-To: tobias@schlitt.info Organization: Schlitt IT Consulting User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041124 Thunderbird/0.9 Mnenhy/0.6.0.104 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Johannes Schlueter Cc: internals@lists.php.net, Sebastian Bergmann References: <42F7587B.6050901@schlitt.info> <200508081450.46458.johannes@php.net> In-Reply-To: <200508081450.46458.johannes@php.net> X-Enigmail-Version: 0.92.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at php-applications.de Subject: Re: [PHP-DEV] type hinting throwing a fatal error From: tobias@schlitt.info (Tobias Schlitt) Hi Johannes Schlueter! On 08/08/05 14:50 you wrote: >>> The throw an Exception when SPL disabled and an InvalidArgumentException >>> when it is enabled. >>That's senseless when writing applications that shall be version >>independant. Just sticking to Exception should be fine. > No it is not, in your application you can still simply catch Exception to be > independent of SPL since the InvalidArgumentException class extends the > Exception class. But by using nested Exceptions you can catch them > independently. Else you would have to catch every Exception, parse the error > message or trace to see wether it was a problem while calling the > function/method or some code inside the function/method went wrong. The point is, that it's senseless to have it throw any exception that can be disabled, when you want to write portable applications. In that case you still have to stick to catch Exception and have no benefit of it throwing anything else, when SPL is enabled. I would pretty much appreciate it having thrown an InvalidArgumentException, but then this should work everywhere. Regards, -- Tobias Schlitt - Zend Certified Engineer GPG Key: 0xA6529579 a passion for php http://www.schlitt.info Like to say "thank you"? - http://pear.php.net/wishlist.php/toby