How to make mPDF 6.1 work with PHP 7.1.5

青春壹個敷衍的年華 提交于 2019-12-02 12:34:46

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!