Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45130 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2906 invoked from network); 29 Jul 2009 21:33:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jul 2009 21:33:20 -0000 X-Host-Fingerprint: 92.135.47.110 ANantes-258-1-168-110.w92-135.abo.wanadoo.fr Date: Wed, 29 Jul 2009 17:33:18 -0400 Received: from [92.135.47.110] ([92.135.47.110:23219] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/A8-25843-D10C07A4 for ; Wed, 29 Jul 2009 17:33:18 -0400 Message-ID: To: internals@lists.php.net References: User-Agent: Pan/0.132 (Waxed in Black) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Posted-By: 92.135.47.110 Subject: Re: RFC: Replacing errors with Exceptions From: seza@paradoxal.org (Alban) Le Fri, 24 Jul 2009 15:23:21 +0200, user a écrit : > I published a (work in progress) RFC today about replacing certain > errors with exceptions. I know that there already was something similiar > on the php6dev blog, but this is not completly the same, so awating your > comments: > > http://wiki.php.net/rfc/errors_as_exceptions I'm agree for replacing error by exception. Even if this not a good idea, i think there is a big problem with error gesture into php. Exemple : http://fr3.php.net/manual/en/function.simplexml-load-string.php The simplexml_load_string documentation says : « Return Values Returns an object of class SimpleXMLElement with properties containing the data held within the xml document. On errors, it will return FALSE. » That's not true, on error, yes the fonction return false but simplexml_load_string return also an error on not xml formated string. The result is it's impossible to use this function without @ statement. This can be considered as a bug and change the documentation or remove the error in simplexml_load_string will fix the bug. In fact, with exception in place of error, the same problem had a simple solution with try / catch elements. Exception in place of error's make life easy for developpers because if developper want, he can do something by catching exception before the program interrupt.