Laravel/mPDF non-numeric value encountered ErrorEx

2019-08-27 06:44发布

问题:

I update php7.1 to php7.2.1 (PHP 7.2.1 (cli)) my laravel pdf not generated show below errorr:

(1/1) ErrorException

A non-numeric value encountered
in mpdf.php (line 30648)

at HandleExceptions->handleError(
    2, 
    'A non-numeric value encountered', 
    '/opt/lampp/htdocs/mysite/vendor/mpdf/mpdf/mpdf.php', 
    30648, 
    array(
        'size' => 0, 
        'maxsize' => 190.00155555555551245561218820512294769287109375, 
        'fontsize' => 3.704166666666667051543981870054267346858978271484375,
        'usefontsize' => false)
    )
in mpdf.php (line 30648)

回答1:

Based on the error message, you are using mPDF 6.x which is not compatible with PHP 7.2 (and not entirely with PHP 7.1 for that matter).

You should upgrade to mPDF 7 which is officially supported up to PHP 7.2.