For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Friday, March 13, 2015

MPDF error Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in MPDF57\includes\functions.php

MPDF error Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in MPDF57\includes\functions.php
When you download MPDF from http://www.mpdf1.com/mpdf/index.php  and working on it with latest version of PHP you may encounter following error:

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in MPDF57\includes\functions.php on line 99

So How can you solve this problem? follow below steps:

In file "MPDF57/mpdf.php"...........   Line 32140 :  comment listed below line of code:

$temp[2][$iterator] = preg_replace("/^([^\n\t]*?)\t/me","stripslashes('\\1') . str_repeat(' ', ( $tabSpaces - (mb_strlen(stripslashes('\\1')) % $tabSpaces)) )",$temp[2][$iterator]);

TO

//$temp[2][$iterator] = preg_replace("/^([^\n\t]*?)\t/me","stripslashes('\\1') . str_repeat(' ', ( $tabSpaces - (mb_strlen(stripslashes('\\1')) % $tabSpaces)) )",$temp[2][$iterator]);


And also in "MPDF57/includes/function.php"....... Line number: 96 and 97 comment
listed below lines of code:

$str = preg_replace('/\&\#([0-9]+)\;/me', "code2utf('\\1',{$lo})",$str);
$str = preg_replace('/\&\#x([0-9a-fA-F]+)\;/me', "codeHex2utf('\\1',{$lo})",$str);

TO

//$str = preg_replace('/\&\#([0-9]+)\;/me', "code2utf('\\1',{$lo})",$str);
//$str = preg_replace('/\&\#x([0-9a-fA-F]+)\;/me', "codeHex2utf('\\1',{$lo})",$str);


if you are still getting any error then at the top of php page where you are using MPDF use one line of code:

error_reporting(E_ALL ^ E_DEPRECATED);

This will permanently remove the error.
Share:

0 comments:

Post a Comment

How to make center align child div

 How to make center align child div?   Suppose you have 2 Div tag. And want the make inner tag center <div id="d1">      ...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive