News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Andrew Curioso's Blog:
Error handeling stack in PHP 5.3+
November 19, 2010 @ 11:03:37

Andrew Curioso has a post to his blog looking at error handling in PHP 5.3, specifically in creating a "stack" that can provide more than one error handler at a time.

As you may know, set_error_handler can be used to set a custom error handler in PHP. It will catch any errors that happen in the script (with a few notable exceptions). If the function returns false then error handling resumes as normal; otherwise it is assumed that the custom handler took care of things. The problem is that you can only have one error handler active at one time. The purpose of this code is to provide a error handeling stack for PHP.

His example uses closures, so pre-5.3 installs won't be able to use it, but it's an interesting proof of concept to show how you could set four different error handlers on one execution. A code snippet is included to show how it all works.

0 comments voice your opinion now!
error handling stack closure multiple tutorial


blog comments powered by Disqus

Similar Posts

Jonnay\'s Blog: An issue with PHP\'s error handling

Padraic Brady's Blog: An Example Zend Framework Blog App - Part 2: The MVC Application Architecture

RoofTopSolutions.nl: Caching in PHP using the filesystem, APC, and Memecached

MaltBlue.com: Zend Form Mastery with Zend Config - Part 1, Custom Filter Paths

Ruslan Yakushev's Blog: Multiple PHP versions on the same IIS server


Community Events





Don't see your event here?
Let us know!


conference framework symfony community list opinion version artisanfiles voicesoftheelephpant interview security introduction laravel composer series tool language podcast library release

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