Deprecated: preg_replace() [function.preg-replace]

Deprecated: preg_replace() [function.preg-replace]: The /e modifier is deprecated, use preg_replace_callback instead in includes/bbcodes/url_bbcode_include.php on line 21

And the file says:

| PHP-Fusion Content Management System
| Copyright © 2002 - 2009 Nick Jones
| Filename: url_bbcode_include.php
| Author: Wooya
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
if (!defined(“IN_FUSION”)) { die(“Access Denied”); }

//Url BBCode with auto triming long links
$text = preg_replace(’#[url]([\r\n])(http://|ftp://|https://|ftps://)([^\s’"]?)([\r\n])[/url]#sie’, “’<a href=’\2\3’ target=’_blank’ title=’\2\3’>’.trimlink(’\2\3’, 20).(strlen(’\2\3’)>30?substr(’\2\3’, strlen(’\2\3’)-10, strlen(’\2\3’)):’’).’’”, $text);
$text = preg_replace(’#[url]([\r\n]
)([^\s’"]?)([\r\n])[/url]#sie’, “’<a href=‘http://\2’ target=’_blank’ title=’\2’>’.trimlink(’\2’, 20).(strlen(’\2’)>30?substr(’\2’, strlen(’\2’)-10, strlen(’\2’)):’’).’’”, $text);
$text = preg_replace(’#[url=([\r\n])(http://|ftp://|https://|ftps://)([^\s’"]?)](.?)([\r\n])[/url]#si’, ‘<a href=’\2\3’ target=’_blank’ title=’\2\3’>\4’, $text);
$text = preg_replace(’#[url=([\r\n])([^\s’"]?)](.?)([\r\n])[/url]#si’, ‘<a href=‘http://\2’ target=’_blank’ title=’\2’>\3’, $text);

I already tried preg_replace_callback and generates new errors. I’m not that good at PHP language but I know it’s a PHP version related problem.

Danke schon!


well, deprecated means way too old and either not recommended for use or a possible security flaw - which means that a software update is the right answer to this issue. Is there any updated version available? If so, then please perform an update.


It’s PHP-Fusion 7.0 and I already tried an update to 7.6 but same error.
Anything else?

well, since the devs should fix that problem (and obviously did not do so yet) we could try to make it work using a workaround.

Please locate the file includes/bbcodes/url_bbcode_include.php and put an @ right at the beginning of preg_replace there, so that it looks like … = @preg_replace( …

or, one line before (20 or even at the top) try to insert error_reporting(0); and retry.