From 74f135121ae9b92045f3aebb0a2376bfe4836c9d Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 26 Feb 2025 11:56:24 -0600 Subject: [PATCH] Fix support for PDOExceptions When a PDOException is thrown (ex. Illuminate's QueryException) during the initialization of a Collector, the current code falls over because the code property on PDOExceptions are actually strings, and not ints. See [this comment from 15 years ago](https://www.php.net/manual/en/class.pdoexception.php#95812), https://github.com/php/php-src/issues/9529, & https://github.com/php/php-src/issues/12294 --- src/LaravelDebugbar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LaravelDebugbar.php b/src/LaravelDebugbar.php index 54830d804..cfcfc0919 100644 --- a/src/LaravelDebugbar.php +++ b/src/LaravelDebugbar.php @@ -721,7 +721,7 @@ protected function addCollectorException(string $message, Exception $exception) $this->addThrowable( new Exception( $message . ' on Laravel Debugbar: ' . $exception->getMessage(), - $exception->getCode(), + (int) $exception->getCode(), $exception ) );