From: Tim Düsterhus Date: Sun, 28 Jun 2020 13:50:05 +0000 (+0200) Subject: Fix PHP 8 compatibility for WCF::handleError() X-Git-Tag: 5.2.8~32^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0267fa9af7e18aa6449726f748e672cdac192d12;p=GitHub%2FWoltLab%2FWCF.git Fix PHP 8 compatibility for WCF::handleError() Quoting from the UPGRADING manual (https://github.com/php/php-src/blob/php-8.0.0alpha1/UPGRADING): > The @ operator will no longer silence fatal errors (E_ERROR, E_CORE_ERROR, > E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR, E_PARSE). Error handlers > that expect error_reporting to be 0 when @ is used, should be adjusted to > use a mask check instead: --- diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 1bcc9cde96..5f465eeab3 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -336,7 +336,7 @@ class WCF { */ public static final function handleError($severity, $message, $file, $line) { // this is necessary for the shut-up operator - if (error_reporting() == 0) return; + if (!(error_reporting() & $severity)) return; throw new ErrorException($message, 0, $severity, $file, $line); }