[STDERR] PHP Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in includes/bbcode.php on line 483\n
happens on a viewtopic page..
replace:
$tpl = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $tpl);
by:
$tpl = preg_replace_callback(
'/{L_([A-Z_]+)}/',
function ($matches) use ($user) {
$key = $matches[1]; // Get the matched key without {L_ and }
return (!empty($user->lang[$key])) ? $user->lang[$key] : ucwords(strtolower(str_replace('_', ' ', $key)));
},
$tpl
);
Then it started same error on line 112 which seems to be fixed replacing:
$message = preg_replace($preg['search'], $preg['replace'], $message);
$preg = array('search' => array(), 'replace' => array());
by:
$preg = array('search' => array(), 'replace' => array());
$message = preg_replace_callback($preg['search'], function ($matches) use ($preg) {
// Perform the replacement logic here. You can modify this as needed.
$index = array_search($matches[0], $preg['search']);
return $preg['replace'][$index]; // Adjust this logic based on your needs
}, $message);