From c7b3d1c8dddb7c64b15ec7bcec2f2e3b9c9cbfb6 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 7 Jul 2018 00:16:26 +0200 Subject: [PATCH] thumb: catch php errors during (gd) resize Image response if GD fails on PHP 7, making it behave identical to exec. Incompatible with PHP 5, where it will show a generic html error page, regressing for convert exceptions. --- thumb/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thumb/index.php b/thumb/index.php index 532499f..1d36948 100644 --- a/thumb/index.php +++ b/thumb/index.php @@ -16,7 +16,7 @@ if (!file_exists($imgpath)) { try { $target = mkthumb($imgpath, $width, $height); } -catch (Exception $e) { +catch (Throwable $e) { http_response_code($e->getCode() ?: 500); $target = '500.png'; if (file_exists($target)) { -- 2.30.0