0

i am having issue with deprecated function of preg_replace(). it says write preg_replace_callback(); instead.

can you guide me how i will write the following code in newer version of PHP ?

$query_string = preg_replace('/([^a-z0-9])(s|sessionhash)=[a-z0-9]{32}(&|&)?/', '\\1', $match[2]);
$foruminfo['link'] = $match[1] . '?' . $vbulletin->session->vars['sessionurl_js'] . substr($query_string, 1);

thanks.

chris85
  • 23,846
  • 7
  • 34
  • 51
Zain Azeem
  • 19
  • 1
  • 6
  • Can you post the actual error message? You aren't using the `e` modifier which is what is actually deprecated. – John Conde Mar 29 '18 at 20:55
  • @JohnConde this is the real error massage, Warning: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in ..../includes/class_bootstrap.php(430) – Zain Azeem Mar 29 '18 at 20:58
  • Your code has no `e` modifier so this wouldn't produce that warning. Example of how that warning is produced https://3v4l.org/O3d8Y, example of your code https://3v4l.org/emqAG. Ignore the undefined notices. Perhaps you used a different delimiter, or have a different regex? – chris85 Mar 29 '18 at 21:25

0 Answers0