This topic is locked
[SOLVED]

 DOMPDF PHP 7.2 error

3/8/2020 4:18:55 PM
PHPRunner General questions
K
kdgsv author

Hi,
I've updated my our webserver at teh weeken to Ubuntu 18.04 + PHP7.2
DOMPDF is rhowing out an error while try to create a pdf:

Fatal error: Uncaught DOMPDF_Exception: Function create_function() is deprecated 8192


Is there a way to fix this?
Thank you
Matthias

Admin 3/8/2020

If looks like you are using an older version of PHPRunner. You can switch to PHPRunner 10.3 where we no longer use DOMPDF.

mbintex 3/9/2020

Have several Webservers with PHP 7.2, 7.3 and 7.4 and no problem with Phprunner 9.8 and DOMPDF.

K
kdgsv author 3/15/2020

Thx mbintex,
Got it working by doing this change in "text_frame_reflower.cls.php
-

array_walk($words, create_function('&$val,$str', '$val = Font_Metrics::get_text_width($str, "'.addslashes($font).'", '.$size.', '.$word_spacing.', '.$char_spacing.');'));


+

array_walk($words, function(&$val,$str) use($font, $size, $word_spacing, $char_spacing){ $val = Font_Metrics::get_text_width($val, $font, $size, $word_spacing, $char_spacing); });


Have a nice day.
Matthias