The Everywhere Cloud

Deploy an instance.
Accelerate your application.

Avoiding the preg_replace() /e Modifier in PHP

After upgrading PHP, some scripts such as those used in old Drupal systems may report an error on preg_replace() that "the /e modifier is no longer supported" due to the modifier's deprecation and removal for being a security risk. Replace it with preg_replace_callback() to solve the problem.


1. Find the preg_replace() function.

preg_replace ("/".$pattern."/e", $replacement, $subject);

2. Convert it to the preg_replace_callback() function as shown.

        function ($args) { return nameOfCallback($args); },



Popular posts from this blog

Enabling HTTPS in Home Assistant

Configuring the FreeBSD Firewall with IPFW

Running Home Assistant on FreeBSD Servers