Throwing Exceptions When Php Errors/warnings Occur

That just happened to me. Imagine a long running script writing to a database within a transaction. The script may time out or run out of memory, thus causing a PHP error that can’t be catched within a try catch/block. Yes, one could manually define an error handler with set_error_handler but I guess this is something that could be built right into the core. What do you guys think? I like the idea of errors being treated as exceptions that can always be catched and handled.

According to this page:

So, I think it’s already implemented.

Ah, thanks Keith, didn’t see that. Yet another point to look forward to Yii 2.0 :) Very nice. Hope the new handler can also be configured to throw exceptions on warnings (deprecated warnings etc.). I guess this could be useful too

Also Yii 2 will probably handle fatal errors. These, of course cannot be catched but at least it is possible to display these in a nice way and log using Yii router.