I'm personally a fan of errors and well defined return values. Exceptions doesn't solve any problem unless your problem is that your code is not enough spaghetti-ish. But I agree with "All fatal errors should be changed to catchable fatal errors".
~Hannes On 9 March 2011 15:18, Martin Scotta <martinsco...@gmail.com> wrote: > Fatal error are most dumb feature in the language. > The are lot of "blind" areas where you don't know if you will ever > return... > > include "file.php"; > new Class(); > call_func(); > > All fatal errors should be changed to "catchable fatal errors" so > applications will be able to recover themselves... and if they don't catch > the error... then die. > > it would be nice if all errors could be changed into exceptions. > > Martin Scotta > > > > On Wed, Mar 9, 2011 at 10:56 AM, Hannes Landeholm <landeh...@gmail.com>wrote: > >> I second making time limit reached catchable. All non catchable fatal >> errors >> are a problem for me. I need to handle problems gracefully to ensure the >> stability of production systems instead of PHP just killing itself without >> warning. I just reported a similar issue: >> http://bugs.php.net/bug.php?id=54195 >> >> A simple way to implement this would be to register a function that would >> be >> called N seconds before the script would timeout. >> >> register_timeout_handler(2, function() { die("PHP timed out."); }); >> >> It would be called just as a shutdown function - in fact I'd like to use >> the >> same function as my shutdown function and get the error with >> error_get_last(). Of course set_time_limit(0) could be used in this >> function >> to prevent the timeout of the timeout handler. This does not "prevent" >> timeout since set_time_limit could have been called by the script before >> the >> timeout anyway. >> >> On that note I also miss a function which returns the time the script can >> keep running for. If that calculate needs to be calculated to implemented >> to >> implement this, why not make the value available to the PHP script? >> >> ~Hannes >> >> On 9 March 2011 02:30, David Muir <davidkm...@gmail.com> wrote: >> >> > Although it doesn't let you recover from a timeout, you could use >> > register_shutdown_function to gracefully exit after a fatal error. >> > >> > register_shutdown_function(function(){ >> > $error = error_get_last(); >> > if($error && $error['type'] === E_ERROR){ >> > echo 'PHAIL! Oh noes, something went wrong!'; >> > // do whatever else you need to do before quitting >> > } >> > }); >> > >> > Cheers, >> > David >> > >> > On 08/03/11 22:39, Pierre Joye wrote: >> > > hi, >> > > >> > > is not the goal of this setting to prevent that a script runs longer >> > > than a given time? A catchable error will prevent that to happen. >> > > >> > > On Tue, Mar 8, 2011 at 2:05 PM, Sebastian Bergmann <sebast...@php.net >> > >> > wrote: >> > >> Could set_time_limit() be changed in such a way that it triggers a >> > >> catchable fatal error instead of a fatal error? Thanks! >> > >> >> > >> -- >> > >> Sebastian Bergmann Co-Founder and Principal >> > Consultant >> > >> http://sebastian-bergmann.de/ >> > http://thePHP.cc/ >> > >> >> > >> -- >> > >> PHP Internals - PHP Runtime Development Mailing List >> > >> To unsubscribe, visit: http://www.php.net/unsub.php >> > >> >> > >> >> > > >> > > >> > >> > >> > -- >> > PHP Internals - PHP Runtime Development Mailing List >> > To unsubscribe, visit: http://www.php.net/unsub.php >> > >> > >> > >