![]() |
|
sfErrorHandlerPlugin - 1.0.10Enhanced error handling for Symfony |
|
![]() |
19
users
Sign-in
to change your status |
Aims to catch and deal with most, if not all, errors within Symfony |
Provides error handling to rethrow PHP errors as sfExceptions, which rather than cause a white screen will now produce the 500 page in a prod env or a stack trace in dev env.
| Name | Status | |
|---|---|---|
|
|
lead | moc.ku.php <<ta>> eel |
Copyright (c) 2008 Lee Bolding
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.
| Version | License | API | Released |
|---|---|---|---|
| 1.0.10stable | MIT license | 1.0.0stable | 24/05/2009 |
| 1.0.9stable | MIT license | 1.0.0stable | 02/05/2009 |
| 1.0.8stable | MIT license | 1.0.0stable | 02/03/2009 |
| 1.0.7stable | MIT license | 1.0.0stable | 09/02/2009 |
| 1.0.6stable | MIT license | 1.0.0stable | 08/12/2008 |
| 1.0.5stable | MIT license | 1.0.0stable | 23/11/2008 |
| 1.0.4stable | MIT license | 1.0.0stable | 18/11/2008 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.10stable | MIT license | 1.0.0stable | 24/05/2009 |
| 1.0.9stable | MIT license | 1.0.0stable | 02/05/2009 |
| 1.0.8stable | MIT license | 1.0.0stable | 02/03/2009 |
| 1.0.7stable | MIT license | 1.0.0stable | 09/02/2009 |
| 1.0.6stable | MIT license | 1.0.0stable | 08/12/2008 |
| 1.0.5stable | MIT license | 1.0.0stable | 23/11/2008 |
| 1.0.4stable | MIT license | 1.0.0stable | 18/11/2008 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.10stable | MIT license | 1.0.0stable | 24/05/2009 |
| 1.0.9stable | MIT license | 1.0.0stable | 02/05/2009 |
| 1.0.8stable | MIT license | 1.0.0stable | 02/03/2009 |
| 1.0.7stable | MIT license | 1.0.0stable | 09/02/2009 |
Array
Array
Array
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.
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
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 (or sfHardenedRenderingFilterCompat on Symfony 1.0) 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.
sf_fatal_error_handlerI'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 :)
