Deprecated function: preg_replace()

Created on 3 April 2014, about 10 years ago
Updated 27 February 2024, 4 months ago

If your site is running on php 5.5 you will receive this error message.
Deprecated function: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in _bible_blsaddLink() (line 2974 of /mnt/www/html/ucg7dev/docroot/sites/all/modules/bible/bible.module).

There is a simple fix, it is suggested to instead use preg_replace_callback(), which I'm told is more performant and will work on PHP 5 and above.

I was going to provide a patch, but this module doesn't provide a public working git repo of the latest DEV or version to work from.

Below is the changes I made to fix the issue. Starting on line 3014 of bible.module (version 7.x-1.5-alpha4).

function _bible_blsaddLink($text = '') {
  global $book_list, $book_namelist;
  $book_regex = $book_list .'|'. str_replace(';', '|', $book_namelist);
  $pattern_regex = '/('. $book_regex .')[:. ]+(\d{1,3}):(\d{1,3}(?:-\d{1,3})?)([#\^]\w+)?([\&]\w+)?(\s?)/';
  $replacement_regex = '_bible_blsdivhtml';
  $text = preg_replace_callback($pattern_regex, $replacement_regex, $text);
  return $text;
}


function _bible_blsdivhtml($m) {
  $script= $m[0];
  $book  = $m[1];
  $chap  = $m[2];
  $verse = $m[3];
  $para  = $m[4];
  $func  = $m[5];
  $tail  = $m[6];

πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States travelertt Cincinnati

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024