Author Topic: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead  (Read 337 times)

Offline svsanchez

  • Posts: 510
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!

Offline dbs

  • Betatester
  • **
  • Posts: 8338
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
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.

Offline hgs

  • Betatester
  • **
  • Posts: 1261
    • EFG MG
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.
LG Harald

"Fange nie an, aufzuhören - höre nie auf, anzufangen." Marcus Tullius Cicero (106-43 v.Chr.)

Offline svsanchez

  • Posts: 510
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

Offline svsanchez

  • Posts: 510
Ok, so I installed it on the test domain. Where do I send the login credentials?

Offline hgs

  • Betatester
  • **
  • Posts: 1261
    • EFG MG
Send a PM to dbs or me, we will then exchange information.
LG Harald

"Fange nie an, aufzuhören - höre nie auf, anzufangen." Marcus Tullius Cicero (106-43 v.Chr.)

Offline svsanchez

  • Posts: 510
Hello, I sent the PM to both (hgs + dbs).

Offline svsanchez

  • Posts: 510
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.

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3049
  • Gender: Female
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
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.
Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"You have to take the men as they are… but you can not leave them like that !" :-P
Das tägliche Stoßgebet: Oh Herr, wirf Hirn vom Himmel !