News Feed
Sections
News Archive


Community Events
php|tek 2008 PHP Conference



feed this:

Stefan Priebsch's Blog:
Turning errors into exceptions
0 comments :: posted Wednesday April 30, 2008 @ 12:53:35
voice your opinion now!

In a recent blog entry Stefan Priebsch shows how to take an error thrown by your script and turn it into an exception (to make things like catchable fatal errors).

While I would personally prefer an exception to be thrown in the first place, it is pretty easy to convert errors to exceptions in PHP.

His example is pretty simple - you set a custom error handler in your script that pulls in the error information and tosses an exception based on the error number the handler is given. Then you can use the try/catch method to see if your script has tossed an exception of the fatal error type. Nice simple solution to handle an interesting little problem.

tagged with: error exception convert try catch fatal errorhandler


Martynas Jusevicius' Blog:
PHP 5 Features Exceptions
0 comments :: posted Tuesday March 25, 2008 @ 10:21:11
voice your opinion now!

On his blog today Martynas Jusevicius talks about a feature that was new in PHP5 - Exceptions:

A useful new feature in PHP 5 is exception handling via the try/throw/catch paradigm. An exception may be thrown and caught. If an exception is thrown in code surrounded by try, the following statements will not be executed, and the exception will be handled by the first matching catch block.

He gives a high-level overview of how Exceptions in PHP5 work and includes a simple example from his work with his DIY Framework.

tagged with: php5 exception feature try catch extend framework


database pecl application release code security zendframework conference package ajax zend job framework releases developer PHP5 mysql book cakephp PEAR

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework