To you both, this is especially, for library code like Zend Framework. The library cannot expect the user to have the error handle set, so it would have to replace the error handler before every line which it wants to try {} and reset it after the catch. This is not really a clean solution, at it can occur pretty often.
Kalle Sommer Nielsen schrieb: > 2009/7/24 <u...@domain.invalid>: >> 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 a big -1, I don't see a big reason for wrapping all my code in a > try/catch block when im writing flat out procedural for example, PHP > isn't an OO-only language, if you need to catch such errors via > exceptions you can simply do it by having a custom error handler and > the ErrorException as you linked to, like: > > set_error_handler(function($severity, $message, $file = NULL, $line = > NULL, $context = NULL) > { > if(!(error_reporting() & $severity)) > { > return; > } > > throw new ErrorException($message, 0, $severity, $file, $line, > $context); > }); > > I don't know if PHP should adopt code into the core that can be done > in less than 10 lines, however with an ini setting it might work as > long its off by default, but I'm not sure how many others here are > happy about adding another ini setting for this. > > > ps. Fix your email when posting > > -- ................................... : ___ _ ___ ___ ___ _ ___ : : | \ /_\ / __| _ \ _ (_) \ : : | |) / _ \\__ \ _/ / | |) | : : |___/_/:\_\___/_| |_|_\_|___/ : :........:........................: : Web : http://www.dasprids.de : : E-mail : m...@dasprids.de : : Jabber : jab...@dasprids.de : : ICQ : 105677955 : :........:........................: -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php