@@ -131,6 +131,7 @@ public function load(array $configs, ContainerBuilder $container)
131
131
$ this ->registerProfilerConfiguration ($ config ['profiler ' ], $ container , $ loader );
132
132
$ this ->registerCacheConfiguration ($ config ['cache ' ], $ container );
133
133
$ this ->registerWorkflowConfiguration ($ config ['workflows ' ], $ container , $ loader );
134
+ $ this ->registerDebugConfiguration ($ config ['php_errors ' ], $ container , $ loader );
134
135
135
136
if ($ this ->isConfigEnabled ($ container , $ config ['router ' ])) {
136
137
$ this ->registerRouterConfiguration ($ config ['router ' ], $ container , $ loader );
@@ -147,27 +148,6 @@ public function load(array $configs, ContainerBuilder $container)
147
148
$ this ->registerPropertyInfoConfiguration ($ config ['property_info ' ], $ container , $ loader );
148
149
}
149
150
150
- $ loader ->load ('debug_prod.xml ' );
151
- $ definition = $ container ->findDefinition ('debug.debug_handlers_listener ' );
152
-
153
- if ($ container ->hasParameter ('templating.helper.code.file_link_format ' )) {
154
- $ definition ->replaceArgument (5 , '%templating.helper.code.file_link_format% ' );
155
- }
156
-
157
- if ($ container ->getParameter ('kernel.debug ' )) {
158
- $ definition ->replaceArgument (2 , E_ALL & ~(E_COMPILE_ERROR | E_PARSE | E_ERROR | E_CORE_ERROR | E_RECOVERABLE_ERROR ));
159
-
160
- $ loader ->load ('debug.xml ' );
161
-
162
- // replace the regular event_dispatcher service with the debug one
163
- $ definition = $ container ->findDefinition ('event_dispatcher ' );
164
- $ definition ->setPublic (false );
165
- $ container ->setDefinition ('debug.event_dispatcher.parent ' , $ definition );
166
- $ container ->setAlias ('event_dispatcher ' , 'debug.event_dispatcher ' );
167
- } else {
168
- $ definition ->replaceArgument (1 , null );
169
- }
170
-
171
151
$ this ->addAnnotatedClassesToCompile (array (
172
152
'**Bundle \\Controller \\' ,
173
153
'**Bundle \\Entity \\' ,
@@ -417,6 +397,48 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde
417
397
}
418
398
}
419
399
400
+ /**
401
+ * Loads the debug configuration.
402
+ *
403
+ * @param array $config A php errors configuration array
404
+ * @param ContainerBuilder $container A ContainerBuilder instance
405
+ * @param XmlFileLoader $loader An XmlFileLoader instance
406
+ */
407
+ private function registerDebugConfiguration (array $ config , ContainerBuilder $ container , XmlFileLoader $ loader )
408
+ {
409
+ $ loader ->load ('debug_prod.xml ' );
410
+
411
+ $ debug = $ container ->getParameter ('kernel.debug ' );
412
+
413
+ if ($ debug ) {
414
+ $ loader ->load ('debug.xml ' );
415
+
416
+ // replace the regular event_dispatcher service with the debug one
417
+ $ definition = $ container ->findDefinition ('event_dispatcher ' );
418
+ $ definition ->setPublic (false );
419
+ $ container ->setDefinition ('debug.event_dispatcher.parent ' , $ definition );
420
+ $ container ->setAlias ('event_dispatcher ' , 'debug.event_dispatcher ' );
421
+ }
422
+
423
+ $ definition = $ container ->findDefinition ('debug.debug_handlers_listener ' );
424
+
425
+ if (!$ config ['log ' ]) {
426
+ $ definition ->replaceArgument (1 , null );
427
+ }
428
+
429
+ if (!$ config ['throw ' ]) {
430
+ $ container ->setParameter ('debug.error_handler.throw_at ' , 0 );
431
+ }
432
+
433
+ $ definition ->replaceArgument (4 , $ debug );
434
+
435
+ if ($ container ->hasParameter ('templating.helper.code.file_link_format ' )) {
436
+ $ definition ->replaceArgument (5 , '%templating.helper.code.file_link_format% ' );
437
+ }
438
+
439
+ $ definition ->replaceArgument (6 , $ debug );
440
+ }
441
+
420
442
/**
421
443
* Loads the router configuration.
422
444
*
0 commit comments