Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in
mpdfを使おうとしたら上記エラーがでたphpのバージョン(php5.6)があっていないのだろう。 (mpdfとはphpからpdfを生成するライブラリ
https://github.com/mpdf/mpdf )
preg_replace ではなくpreg_replace_callback を使えとのことだろう。 はてどうするか。
mpdfフォルダのincludes下のfunctions.phpの62行目あたりを
if(!function_exists('strcode2utf')){ function strcode2utf($str,$lo=true) { //converts all the &#nnn; and &#xhhh; in a string to Unicode if ($lo) { $lo = 1; } else { $lo = 0; } $str = preg_replace('/\&\#([0-9]+)\;/me', "code2utf('\\1',{$lo})",$str); $str = preg_replace('/\&\#x([0-9a-fA-F]+)\;/me', "codeHex2utf('\\1',{$lo})",$str); return $str; } }
if(!function_exists('strcode2utf')){ function strcode2utf($str,$lo=true) { //converts all the &#nnn; and &#xhhh; in a string to Unicode if ($lo) { $lo = 1; } else { $lo = 0; } //$str = preg_replace('/\&\#([0-9]+)\;/me', "code2utf('\\1',{$lo})",$str);//ここと //$str = preg_replace('/\&\#x([0-9a-fA-F]+)\;/me', "codeHex2utf('\\1',{$lo})",$str);//ここです $str = preg_replace_callback('/&#([0-9]+)\;/m', function($m){ return code2utf($m[1],$lo); }, $str); $str = preg_replace_callback('/&#([0-9]+)\;/m', function($m){ return codeHex2utf($m[1],$lo);}, $str); return $str; } }
にかえる
//$str = preg_replace('/\&\#([0-9]+)\;/me', "code2utf('\\1',{$lo})",$str); //$str = preg_replace('/\&\#x([0-9a-fA-F]+)\;/me', "codeHex2utf('\\1',{$lo})",$str); $str = preg_replace_callback('/&#([0-9]+)\;/m', function($m){ return code2utf($m[1],$lo); }, $str); $str = preg_replace_callback('/&#([0-9]+)\;/m', function($m){ return codeHex2utf($m[1],$lo);}, $str);
とうまくいきます