问题
Developed on on a WAMP stack with PHP 5.6, then transferred to LAMP 7.1.5 Everything is working OK except for mPDF 6.1.0 which is giving the following:
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
I tried the solutions mentioned at Upgrade to PHP7.1 and MPDF show error - A non-numeric value encountered at line 30648 but that hasn't fixed it.
回答1:
Edit mpdf.php, line 89, replace:
$errorlevel = error_reporting($errorlevel & ~E_NOTICE);
with:
$errorlevel = error_reporting($errorlevel & ~(E_NOTICE|E_WARNING));
Reason: https://stackoverflow.com/a/42044413/8284401
来源:https://stackoverflow.com/questions/45101160/how-to-make-mpdf-6-1-work-with-php-7-1-5