如何使mPDF 6.1与PHP 7.1.5一起工作

时间:2017-07-14 10:51:46

标签: mpdf php-7.1

使用PHP 5.6在WAMP堆栈上开发,然后转移到LAMP 7.1.5 一切正常,除了mPDF 6.1.0,它提供以下内容:

Warning: A non-numeric value encountered in /var/sites/s/example.com/php_libs/vendor/mpdf/mpdf/mpdf.php on line 30648

Warning: A non-numeric value encountered in /var/sites/s/example.com/php_libs/vendor/mpdf/mpdf/mpdf.php on line 17074

Warning: A non-numeric value encountered in /var/sites/s/example.com/php_libs/vendor/mpdf/mpdf/mpdf.php on line 17075

Warning: A non-numeric value encountered in /var/sites/s/example.com/php_libs/vendor/mpdf/mpdf/mpdf.php on line 17093

我尝试了Upgrade to PHP7.1 and MPDF show error - A non-numeric value encountered at line 30648中提到的解决方案但尚未修复它。

1 个答案:

答案 0 :(得分:10)

编辑mpdf.php,第89行,替换:

$errorlevel = error_reporting($errorlevel & ~E_NOTICE);

使用:

$errorlevel = error_reporting($errorlevel & ~(E_NOTICE|E_WARNING));

原因:https://stackoverflow.com/a/42044413/8284401