Pārlūkot izejas kodu

phP7.4兼容问题

zgg 7 stundas atpakaļ
vecāks
revīzija
40a84e8f90
1 mainītis faili ar 12 papildinājumiem un 0 dzēšanām
  1. 12 0
      thinkphp/library/think/Error.php

+ 12 - 0
thinkphp/library/think/Error.php

@@ -68,6 +68,18 @@ class Error
      */
     public static function appError($errno, $errstr, $errfile = '', $errline = 0)
     {
+        
+        // 7.4 兼容:废弃警告(E_DEPRECATED)不再当作异常抛出,避免老库 PHPExcel 的 {} 字符串偏移语法导致导出崩溃
+        if ($errno === E_DEPRECATED) {
+            return;
+        }
+
+        // 7.4兼容,阻止数组校验抛异常
+        if ($errno === 8 && strpos($errstr, 'Trying to access array offset on value of type') !== false) {
+            return;
+        }
+        
+        
         $exception = new ErrorException($errno, $errstr, $errfile, $errline);
         if (error_reporting() & $errno) {
             // 将错误信息托管至 think\exception\ErrorException