From: Alexander Ebert Date: Tue, 14 Jan 2020 16:12:07 +0000 (+0100) Subject: `IMAGETYPE_WEBP` is available since PHP 7.1 only X-Git-Tag: 5.2.2~55 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=01a8094048b233d56753b6aed3a4e6332b4b2957;p=GitHub%2FWoltLab%2FWCF.git `IMAGETYPE_WEBP` is available since PHP 7.1 only --- diff --git a/wcfsetup/install/files/lib/system/upload/AvatarUploadFileValidationStrategy.class.php b/wcfsetup/install/files/lib/system/upload/AvatarUploadFileValidationStrategy.class.php index a5b52ec19d..7125d3f088 100644 --- a/wcfsetup/install/files/lib/system/upload/AvatarUploadFileValidationStrategy.class.php +++ b/wcfsetup/install/files/lib/system/upload/AvatarUploadFileValidationStrategy.class.php @@ -25,7 +25,9 @@ class AvatarUploadFileValidationStrategy extends DefaultUploadFileValidationStra $uploadFile->setValidationErrorType('tooSmall'); return false; } - else if ($imageData[2] === IMAGETYPE_WEBP) { + // `IMAGETYPE_WEBP` is available since PHP 7.1, remove the first check as soon as we + // drop the support for ancient PHP versions. + else if (!defined('IMAGETYPE_WEBP') || $imageData[2] === IMAGETYPE_WEBP) { // Reject WebP images regardless of any file extension restriction, they are // neither supported in Safari nor in Internet Explorer 11. We can safely lift // this restriction once Apple implements the support or if any sort of fall-