The Debug Component
Note
If you install this component outside of a Symfony application, you mustrequire the file in your code to enable the classautoloading mechanism provided by Composer. Readthis article for more details.
The Debug component provides several tools to help you debug PHP code.Enable all of them by calling this method:
The method registers anerror handler, an exception handler anda special class loader.
Caution
You should never enable the debug tools, except for the error handler, in aproduction environment as they might disclose sensitive information to the user.
The class catches PHP errorsand converts them to exceptions (of class or
FatalErrorException
for PHPfatal errors):
This error handler is enabled by default in the production environment when theapplication uses the FrameworkBundle because it generates better error logs.
Note
If the isavailable, the handler uses a Symfony Response object; if not, it fallsback to a regular PHP response.
The attempts tothrow more helpful exceptions when a class isn't found by the registeredautoloaders. All autoloaders that implement a findFile()
method are replacedwith a DebugClassLoader
wrapper.
Using the is done by calling its staticenable()
method: