Re: Re: RFC: Replacing errors with Exceptions

From: Date: Thu, 30 Jul 2009 08:48:49 +0000
Subject: Re: Re: RFC: Replacing errors with Exceptions
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-45135@lists.php.net to get a copy of this message
On Wed, Jul 29, 2009 at 23:33, Alban<seza@paradoxal.org> wrote: > 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 result is it's impossible to use this function without @ statement. Are you intentionally ignoring what I've said previously in the thread? Please stop using SimpleXML as an example. You do not need @. <?php libxml_use_internal_errors(true); $sxe = simplexml_load_string("<?xml version='1.0'><broken><xml></broken>"); if (!$sxe) { echo "Failed loading XML\n"; foreach(libxml_get_errors() as $error) { echo "\t", $error->message; } } Outputs: Failed loading XML Blank needed here parsing XML declaration: '?>' expected Opening and ending tag mismatch: xml line 1 and broken Premature end of data in tag broken line 1 No PHP warnings at all. Again. The examples you are looking for are network issues with fopen(), file_get_contents() and such things. -Hannes

« previous php.internals (#45135) next »