@@ -101,6 +101,13 @@ class LaravelDebugbar extends DebugBar
101
101
*/
102
102
protected $ is_lumen = false ;
103
103
104
+ /**
105
+ * Laravel default error handler
106
+ *
107
+ * @var callable|null
108
+ */
109
+ protected $ prevErrorHandler = null ;
110
+
104
111
protected ?string $ editorTemplateLink = null ;
105
112
protected array $ remoteServerReplacements = [];
106
113
protected bool $ responseIsModified = false ;
@@ -173,7 +180,7 @@ public function boot()
173
180
174
181
// Set custom error handler
175
182
if ($ config ->get ('debugbar.error_handler ' , false )) {
176
- set_error_handler ([$ this , 'handleError ' ]);
183
+ $ this -> prevErrorHandler = set_error_handler ([$ this , 'handleError ' ]);
177
184
}
178
185
179
186
$ this ->selectStorage ($ this );
@@ -649,16 +656,17 @@ public function addCollector(DataCollectorInterface $collector)
649
656
*/
650
657
public function handleError ($ level , $ message , $ file = '' , $ line = 0 , $ context = [])
651
658
{
652
- $ exception = new \ErrorException ($ message , 0 , $ level , $ file , $ line );
653
- if (error_reporting () & $ level ) {
654
- throw $ exception ;
655
- }
656
-
657
- $ this ->addThrowable ($ exception );
659
+ $ this ->addThrowable (new \ErrorException ($ message , 0 , $ level , $ file , $ line ));
658
660
if ($ this ->hasCollector ('messages ' )) {
659
661
$ file = $ file ? ' on ' . $ this ['messages ' ]->normalizeFilePath ($ file ) . ": {$ line }" : '' ;
660
662
$ this ['messages ' ]->addMessage ($ message . $ file , 'deprecation ' );
661
663
}
664
+
665
+ if (! $ this ->prevErrorHandler ) {
666
+ return ;
667
+ }
668
+
669
+ return call_user_func ($ this ->prevErrorHandler , $ level , $ message , $ file , $ line , $ context );
662
670
}
663
671
664
672
/**
0 commit comments