WebsiteBaker Community Forum

WebsiteBaker Support (2.10.x) => General Help & Support => Topic started by: svsanchez on August 29, 2020, 12:57:06 AM

Title: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Post by: svsanchez on August 29, 2020, 12:57:06 AM
Hello.

I just noticed that I have thousands upon thousands of messages like this in all my error logs:

[28-Aug-2020 08:18:39 UTC] PHP Deprecated:  preg_replace(): The /e modifier is deprecated, use preg_replace_callba ck instead in /home/deguatec/public_html/modules/show_menu2/include.php on line 216

A LITTLE INFO ABOUT MY SITE:

1) First of all, sorry to publish here, but I couldn't find the create new post in the WB 2.8.x forum

2) My site is www.deguate.com.gt

3) I am still using WB 2.8.3 because when I upgraded to 2.10.x or 2.12.x my site became horribly slow (1 minute to start showing the pages). I tried upgrading several times with the same result in speed, don't know why.

4) I found a topic talking about a patch for this problem (https://forum.WebsiteBaker.org/index.php/topic,27343.msg188689.html#msg188689), but the resource seems to not exist anymore (https://code.google.com/archive/p/wbcom/)

5) My site has sveral hundred categoris and subcategories. Each one of them has an error log. Depending on the traffic of the pages on the category, the error log on each of them can grow to few thousand bytes to more than 1GB in a month, so I need to fix this ASAP to stop utilizing all my hosting space in error logs!

Thank you!
Title: Re: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Post by: dbs on August 29, 2020, 07:42:39 AM
Hello, you can do this:
- create a copy of your site in a subdomain and give us access to find the problems
  - also for upgrade test is this the best way
- or deactivate the error logging in your WB Settings

I hope it is clear you can't use your old system with the newest databases or PHP versions.
You have to upgrade.
Title: Re: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Post by: hgs on August 29, 2020, 06:38:37 PM
2nd possibility
You transfer the website and the database dump to our FTP server and we look at the problems.
If you are interested, send me a PM
problem with this, we can't test it at your hoster, which is probably partly responsible for the slowdown
Therefore only as 2nd possibility.
Title: Re: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Post by: svsanchez on September 01, 2020, 04:29:02 AM
Hello dbs and hgs, thank you both for your help.

I am making a copy of the site on the same server but with another domain.

1) I will upload it as it is right now (version 2.8.3) so that you can see how slow the front end becomes once it is upgraded.

2) Also, you will see how the backend becomes slow because of the big size of the site (I use a mod by Ruud to open only the pages current level (siblings), which is discussed here:

https://forum.WebsiteBaker.org/index.php/topic,25587.msg174593.html#msg174587
Title: Re: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Post by: svsanchez on September 01, 2020, 04:47:21 AM
Ok, so I installed it on the test domain. Where do I send the login credentials?
Title: Re: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Post by: hgs on September 01, 2020, 07:45:31 AM
Send a PM to dbs or me, we will then exchange information.
Title: Re: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Post by: svsanchez on September 01, 2020, 09:14:16 PM
Hello, I sent the PM to both (hgs + dbs).
Title: Re: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Post by: svsanchez on September 04, 2020, 09:08:45 PM
Regarding the original problem:

PHP Deprecated:  preg_replace(): The /e modifier is deprecated, use preg_replace_callba ck instead in /home/deguatec/public_html/modules/show_menu2/include.php on line 216

After checking soem not so big error log files, I noticed that this error stopped at the end of June, so I think it must have been a problem due to the PHP version. I had decided to upgrade my site to 2.12.x and changed the PHP version to 7.1, but since my previous attempts have made the site incredibly slow, I decided to stick with version 2.8.3 until a solution is found for big sites and forgot to change my php version back to 5.6.

So, if you encounter that error, check your php version.
Title: Re: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Post by: DarkViper on September 05, 2020, 03:22:32 PM
preg_replace with modifier 'e' only works with deprecated messages from PHP-5.5 and no longer at all from PHP-7.
In order to keep preg_replace 'e' executable under PHP-7, it must be exchanged for preg_replace_callba ck and the code to be executed converted into a callback function.

See: php.net (https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php#reference.pcre.pattern.modifiers.eval)
Quote from: php.net pcre modifier 'e'
e (PREG_REPLACE_EVAL)
    Warning

    This feature was DEPRECATED in PHP 5.5.0, and REMOVED as of PHP 7.0.0.