How to make mPDF 6.1 work with PHP 7.1.5

2020-04-21 06:36发布

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.

标签: mpdf php-7.1
1条回答
成全新的幸福
2楼-- · 2020-04-21 07:26

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

查看更多
登录 后发表回答