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];
Comments
Comment #1
travelerttComment #2
travelerttComment #3
joebest CreditAttribution: joebest commentedThe suggested code renders my site in blank. My environment is MAMP 3.0 PHP 5.5.10
Comment #4
travelerttYou're not including the
tags right?
What do your error logs say?
Comment #5
joebest CreditAttribution: joebest commentedThanks for your reply.
Not including tags
<?php ?>
No logs error messages are registered. The new code just renders the site as a blank page.
Comment #6
joebest CreditAttribution: joebest commentedhello travlertt,
Just to let you know that I finally placed the code how I think it should be and it resolved the Deprecated function: preg_replace(). Yahoo :)
However I'm getting a whole set of other issues:
I pasted the code by replacing the
function _bible_blsaddLink(
and adding the m$ variable tofunction _bible_blsdivhtml
as follows. Note: line 3023 is the beginning of function _bible_blsdivhtml:Comment #7
joebest CreditAttribution: joebest commentedAfter further debugging, I did the following and it works without errors.
If this was the intended correction, then this issue can be closed. Please note my PHP skills are rusty. Perhaps a patch would have been handy or
bible 7.x-1.5-alpha5
with the corrections. With that said, thanks for the corrections and all efforts are highly appreciated. This module is VERY important and I'm look forward to further enhancements.Kind regards,
Jose
Comment #8
joebest CreditAttribution: joebest commentedMy bad, you did comment about the patch issue:
I hope this gets corrected.
Comment #9
travelerttYes that is the intended correction, (#7). Thank you.
Comment #10
rhuffstedtler CreditAttribution: rhuffstedtler commentedjoebest/travelertt - You should now be able to pull the latest release and patch against it. I haven't started a new dev branch yet, but I should have one up in the next few days as soon as I have another commit to add.
Comment #11
joebest CreditAttribution: joebest commentedrhuffstedtler - using the new update returns the original error
Deprecated function: preg_replace()
Comment #12
rhuffstedtler CreditAttribution: rhuffstedtler commentedjoebest - That would be my expectation. What I was suggesting was that you or travelertt produce a patch with the above changes against the latest release, and I will apply it and start the new dev branch.
Comment #13
berenddeboer CreditAttribution: berenddeboer commentedComment #14
apadernoComment #15
dieuwe