Forum


Replies: 8   Views: 10940
Deprecated: preg_replace(): the /e modifier is deprecated, use preg_replace_callback instead
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by melino  · 31-01-2014 - 23:03

In PHP 5.5 the following notice is displayed:




Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in ...path_to_phpdocx/lib/dompdfParser/include/parserhtml.cls.php on line 442


Any fix for that?


Posted by jorgelj  · 03-02-2014 - 09:15

Hello,



You can avoid that message, it's just a deprecated parameter in PHP 5.5, changing the error reporting level in your PHP config.



Regards.


Posted by melino  · 03-02-2014 - 18:21

Ok, thx!


Posted by Necuima  · 08-03-2014 - 08:37

I changed the error level in php.ini but it made no difference.



Exactly what needs to be changed and where?



Thanks.


Posted by jorgelj  · 10-03-2014 - 10:31

Hello,



You can hide deprecated messages in the php.ini:



error_reporting = E_ALL & ~E_DEPRECATED



or using PHP:




error_reporting(E_ALL ^ E_DEPRECATED);


error_reporting(E_ALL ^ E_DEPRECATED);



Regards.


Posted by ckaibel  · 14-05-2014 - 11:20

Is there any fix without disable deprecated messages?



For the developer this should not be a big problem.


Posted by jorgelj  · 14-05-2014 - 16:08

Hello,



You just need to use this code:



$str = preg_replace_callback(

                        '/>(\s*$\s*)</m',

                        create_function('$matches', "return strpos('$matches[0]', ' ') === false?'><':'> <';"),

                        $str

                        );



instead of the deprecated sentence.



Regards.


Posted by ckaibel  · 15-05-2014 - 08:35

Thanks a lot jorgelj :)


This code fixed a few problems for me.


 


best regards


Chris