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.






-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to