From ef03f1acc93a86af6dd3ea3f3eb93cdd4818ab33 Mon Sep 17 00:00:00 2001 From: Kyryll Kovalenko Date: Fri, 2 Feb 2024 23:35:06 +0100 Subject: [PATCH 1/2] Fix in appendExceptionToException method exception type check --- src/Illuminate/Testing/TestResponse.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Illuminate/Testing/TestResponse.php b/src/Illuminate/Testing/TestResponse.php index ea19db479a03..8eeb31f1c345 100644 --- a/src/Illuminate/Testing/TestResponse.php +++ b/src/Illuminate/Testing/TestResponse.php @@ -1651,8 +1651,7 @@ public function transformNotSuccessfulException($exception) */ protected function appendExceptionToException($exceptionToAppend, $exception) { - $exceptionMessage = $exceptionToAppend->getMessage(); - + $exceptionMessage = is_string($exceptionToAppend) ? $exceptionToAppend : $exceptionToAppend->getMessage(); $exceptionToAppend = (string) $exceptionToAppend; $message = <<<"EOF" From b2500dee7cd80e9000ee1bec5aa0f06888719f3d Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 8 Feb 2024 09:09:30 -0600 Subject: [PATCH 2/2] Update TestResponse.php --- src/Illuminate/Testing/TestResponse.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Illuminate/Testing/TestResponse.php b/src/Illuminate/Testing/TestResponse.php index 8eeb31f1c345..ebf06a7dc1fd 100644 --- a/src/Illuminate/Testing/TestResponse.php +++ b/src/Illuminate/Testing/TestResponse.php @@ -1652,6 +1652,7 @@ public function transformNotSuccessfulException($exception) protected function appendExceptionToException($exceptionToAppend, $exception) { $exceptionMessage = is_string($exceptionToAppend) ? $exceptionToAppend : $exceptionToAppend->getMessage(); + $exceptionToAppend = (string) $exceptionToAppend; $message = <<<"EOF"