Skip to content

Commit e3e331d

Browse files
authored
fix(ErrorHandler): replace array_first with foreach in isNotFoundException (#644)
On newer stacks (Laravel 12.23+/PHP 8.5 polyfill), global array_first no longer accepts a callback, making isNotFoundException() always true and forcing 404 for all exceptions. Replace with a plain foreach to restore correct detection.
1 parent 5749c37 commit e3e331d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Exception/ErrorHandler.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ public function handleException(Throwable $proposedException)
8585
*/
8686
protected function isNotFoundException($exception)
8787
{
88-
return array_first($this->notFoundExceptions, function($type) use ($exception) {
89-
return $exception instanceof $type;
90-
});
88+
foreach ($this->notFoundExceptions as $type) {
89+
if ($exception instanceof $type) {
90+
return true;
91+
}
92+
}
93+
return false;
9194
}
9295

9396
/**

0 commit comments

Comments
 (0)