@@ -22,14 +22,9 @@ Installation
22
22
Usage
23
23
-----
24
24
25
- The ErrorHandler component provides several tools to help you debug PHP code:
26
-
27
- * An **error handler ** that turns PHP errors into exceptions;
28
- * An **exception handler ** that turns uncaught PHP exceptions into nice PHP responses;
29
- * A **debug class loader ** that provides better errors when a class is not found.
30
-
25
+ The ErrorHandler component provides several tools to help you debug PHP code.
31
26
Call this method (e.g. in your :ref: `front controller <architecture-front-controller >`)
32
- to enable all these features in your application::
27
+ to enable all of them in your application::
33
28
34
29
// public/index.php
35
30
use Symfony\Component\ErrorHandler\Debug;
@@ -52,9 +47,10 @@ Turning PHP Errors into Exceptions
52
47
----------------------------------
53
48
54
49
The :class: `Symfony\\ Component\\ ErrorHandler\\ ErrorHandler ` class catches PHP
55
- errors and turns them into PHP's :phpclass: `ErrorException ` objects, except for
56
- fatal PHP errors, which are turned into Symfony's
57
- :class: `Symfony\\ Component\\ ErrorHandler\\ Exception\\ FatalErrorException ` objects.
50
+ errors and uncaught PHP exceptions and turns them into PHP's
51
+ :phpclass: `ErrorException ` objects, except for fatal PHP errors, which are
52
+ turned into Symfony's :class: `Symfony\\ Component\\ ErrorHandler\\ Exception\\ FatalErrorException `
53
+ objects.
58
54
59
55
If the application uses the FrameworkBundle, this error handler is enabled by
60
56
default in the :ref: `production environment <configuration-environments >`
@@ -120,26 +116,6 @@ wrap several function calls inside an anonymous function::
120
116
return $data;
121
117
});
122
118
123
- Debugging Uncaught PHP Exceptions
124
- ---------------------------------
125
-
126
- The :class: `Symfony\\ Component\\ ErrorHandler\\ ExceptionHandler ` class catches
127
- uncaught PHP exceptions and turns them into a nice response, so you can debug
128
- them. It is useful in :ref: `debug mode <debug-mode >` to replace the default
129
- PHP/XDebug output with something prettier and more useful.
130
-
131
- If the :doc: `HttpFoundation component </components/http_foundation >` is
132
- available, the handler returns a Symfony's
133
- :class: `Symfony\\ Component\\ HttpFoundation\\ Response ` object. Otherwise, it returns
134
- a generic PHP response.
135
-
136
- Use the following code (e.g. in your :ref: `front controller <architecture-front-controller >`)
137
- to enable this exception handler::
138
-
139
- use Symfony\Component\ErrorHandler\ExceptionHandler;
140
-
141
- ExceptionHandler::register();
142
-
143
119
.. _component-debug-class-loader :
144
120
145
121
Class Loading Debugger
0 commit comments