@@ -101,6 +101,13 @@ class LaravelDebugbar extends DebugBar
101101 */
102102 protected $ is_lumen = false ;
103103
104+ /**
105+ * Laravel default error handler
106+ *
107+ * @var callable|null
108+ */
109+ protected $ prevErrorHandler = null ;
110+
104111 protected ?string $ editorTemplateLink = null ;
105112 protected array $ remoteServerReplacements = [];
106113 protected bool $ responseIsModified = false ;
@@ -173,7 +180,7 @@ public function boot()
173180
174181 // Set custom error handler
175182 if ($ config ->get ('debugbar.error_handler ' , false )) {
176- set_error_handler ([$ this , 'handleError ' ]);
183+ $ this -> prevErrorHandler = set_error_handler ([$ this , 'handleError ' ]);
177184 }
178185
179186 $ this ->selectStorage ($ this );
@@ -645,16 +652,13 @@ public function addCollector(DataCollectorInterface $collector)
645652 */
646653 public function handleError ($ level , $ message , $ file = '' , $ line = 0 , $ context = [])
647654 {
648- $ exception = new \ErrorException ($ message , 0 , $ level , $ file , $ line );
649- if (error_reporting () & $ level ) {
650- throw $ exception ;
651- }
652-
653- $ this ->addThrowable ($ exception );
655+ $ this ->addThrowable (new \ErrorException ($ message , 0 , $ level , $ file , $ line ));
654656 if ($ this ->hasCollector ('messages ' )) {
655657 $ file = $ file ? ' on ' . $ this ['messages ' ]->normalizeFilePath ($ file ) . ": {$ line }" : '' ;
656658 $ this ['messages ' ]->addMessage ($ message . $ file , 'deprecation ' );
657659 }
660+
661+ return call_user_func ($ this ->prevErrorHandler , $ level , $ message , $ file , $ line , $ context );
658662 }
659663
660664 /**
0 commit comments