Developers

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release 1.0.8 - 02/03/2009

Release 1.0.7 - 09/02/2009

Release 1.0.6 - 08/12/2008

Release 1.0.5 - 23/11/2008

Release 1.0.4 - 18/11/2008

sfErrorHandler plugin (for Symfony 1.1)

The sfErrorHandlerPlugin aims to solve the infamous Symfony white screen of death. It also features an error handler that converts PHP errors to sfLegacyErrorExceptions, so that they can be caught within your code, and dealt with appropriately. This should both greatly reduce time spent debugging Symfony applications during development, and make Symfony applications appear more robust in production.

Installation

Install the plugin

$ symfony plugin:install sfErrorHandlerPlugin

Enable the plugin in your settings.yml

all:
.settings:
enabled_modules: [default, sfErrorHandler, ...]

optional If you don't already have an error500.php in /web/errors then either copy the one in sfErrorHandlerPlugin/errors or create your own. The error page to use is decided from a cascade, the first error page found (in this order) will be used : apps/<app>/config/error_500.php, web/errors/error500.php, config/error_500.php, plugins/sfErrorHandlerPlugin/errors/error500.php

$ cp plugins/sfErrorHandlerPlugin/errors/error500.php web/errors/

Clear your cache

$ symfony cc

Usage

You can check that the plugin is correctly installed by using your dev controller. If you select the 'Logs and Messages' option, you should see that there is now a log entry for sfHardenedRenderingFilter where there was once a log entry for sfRenderingFilter.

Now, whenever an error occurs that would previously have caused a white screen you should observe the following behaviour:

Using a controller with debugging disabled, you'll get served your web/errors/error500.php

Using a controller with debugging enabled, you'll either receive a stack trace and an sfLegacyErrorException OR - for an error that the PHP error handler cannot catch, you'll get a single line containing the error.

TODO

find a way to throw an exception from sf_fatal_error_handler

NOTES

I've tested this quite extensively by purposefully breaking code, introducing parse errors, instantiating non-existent classes and or using undefined classes, and haven't been able to produce a white screen, but if you are able to do so, please send me details of how I can replicate the problem to lee at php.uk.com and I'll try and fix it :)