Question

Welcome.

I have problem, becouse when I installed newest Xampp I have errors on my website, but I can not PHP and I do not know how to repair it.

Error content:

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\xampp\htdocs\EXTREME\system\bbcodes\mail.php on line 35

Mail.php content:

<?php defined('EF5_SYSTEM') || exit;

$_locale->load('mail');

$bbcode_info = array(
    'name' => __('Mail'),
    'description' => __('Displays the text as an e-mail address'),
    'value' => 'mail'
);

if($bbcode_used)
{
    $text = preg_replace('#\[mail=([\r\n]*)([^\s\'\";:\]*?)\](.*?)([\r\n]*)\[/mail\]#sie', "'<a href=\'http://mailto:'.HELP::hide_email('\\2').'\' target=\'_blank\' title=\''.HELP::hide_email('\\2', '\\2').'\'>'.HELP::hide_email('\\2').'</a>'", $text);
    $text = preg_replace('#\[mail\]([\r\n]*)([^\s\'\";:\]*?)([\r\n]*)\[/mail\]#sie', "'<a href=\'http://mailto:'.HELP::hide_email('\\2').'\' target=\'_blank\' title=\''.HELP::hide_email('\\2').'\'>'.HELP::hide_email('\\2').'</a>'", $text);
}
Was it helpful?

Solution

Try without the e modifier, as suggested by the error message

<?php defined('EF5_SYSTEM') || exit;

$_locale->load('mail');

$bbcode_info = array(
    'name' => __('Mail'),
    'description' => __('Displays the text as an e-mail address'),
    'value' => 'mail'
);

if($bbcode_used)
{
    $text = preg_replace('#\[mail=([\r\n]*)([^\s\'\";:\]*?)\](.*?)([\r\n]*)\[/mail\]#si', "'<a href=\'http://mailto:'.HELP::hide_email('\\2').'\' target=\'_blank\' title=\''.HELP::hide_email('\\2', '\\2').'\'>'.HELP::hide_email('\\2').'</a>'", $text);
    $text = preg_replace('#\[mail\]([\r\n]*)([^\s\'\";:\]*?)([\r\n]*)\[/mail\]#si', "'<a href=\'http://mailto:'.HELP::hide_email('\\2').'\' target=\'_blank\' title=\''.HELP::hide_email('\\2').'\'>'.HELP::hide_email('\\2').'</a>'", $text);
}

I've changed #sie to #si in both lines.

The e modifier allowed you to evaluate PHP code in your regular expression, but now it's deprecated and shouldn't be used any longer. And you didn't need it anyway.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top