Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Problems with preg_replace

I have installed a site for a customer on a brand new server. And every time I try to use bb-codes, I get an error like this:

preg_replace() :The /e modifier is deprecated use preg_replace_callback instead

I can see from other forum posts, that others have experienced the same problem with newer versions of PHP. But can somebody tell me, if there's been set a deadline on an update concerning this problem??
janmol attached the following file:
preg_errors.gif [26.61kB / 55 Downloads]
Hey Jan,

Yep it's now deprecated code that's all, I know hein was working on a fix.


I have worked on some of the files long time ago, and I think I shared the files with people too... not sure, but I recalled long time ago.
Please try.. was assumed fixed because nobody gave me replies on it. If need any more tell which one :G
Chan attached the following file:
url.zip [2.17kB / 423 Downloads]
code_gistbbcode_2.zip [3.62kB / 443 Downloads]
Go to Our Github. Check the files.. BBCode is universal compatible, and we have the latest there.
@hien: Ralph68 wrote about registration, not about bbcode.

I can see three solutions.

1. Put an error control oprator (@) before preg_replace
$var = @preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $var);

It turns off also the error logging, but not solves any other similar problem..

2. Replace preg_replace with preg_replace_callback without "/e" modifier

$var = preg_replace_callback('!s:(\d+):"(.*?)";!', function($matches) {
   return 's:'.strlen($matches[2]).':"'.$matches[2].'";';
}, $var);

3. Modify error handler in includes/error_handling_include.php

After this line:
function setError($error_level, $error_message, $error_file, $error_line, $error_context) {

insert this:
if ($error_level == E_DEPRECATED) {

This way any E_DEPRECATED won't be logged.

Anyway I don't know why unserializeFix is needed. I can't find the referenced comment on php.net. It can be a fixed bug. If it is, unserializeFix is not needed anymore.
I did fix the problems in mail_bbcode_include.php and url_bbcode_include.php already. Thanks to this thread and this thread.

But I still have the problem in !autolink_bbcode_include.php and search_bbcode_include.php. I can not find any solutions here on the page or in GitHub.

Any know or can make a fix?
Rimelek, your solutions didn't work for me. :@


I replaced all three bbcodes (mail, url and code) with the links you posted to v9.
Still have this error

When I click the activation link send to my email it returns me to my site with this error.

I also replaced error_handling_include.php from the same source but get the same message when I activate.


Notice: Use of undefined constant E_DEPRECATED_ERROR - assumed 'E_DEPRECATED_ERROR' in /homepages/13/d374099474/htdocs/v7.10secrides.com/includes/error_handling_include.php on line 29


Rimelek, your solutions didn't work for me. :@


Notice: Use of undefined constant E_DEPRECATED_ERROR - assumed 'E_DEPRECATED_ERROR' in /homepages/13/d374099474/htdocs/v7.10secrides.com/includes/error_handling_include.php on line 29

- by Ralph68

Sorry, I couldn't test it and I wrote the name of the constant incorrectly. E_DEPRECATED is the right name. I fixed my previous comment and tested the solution.
Thanks Rimelek that worked.

!autolink_bbcode_include.php and mail_bbcode_include.php I need the fix please?


What he said...
Rimelek attached the following file:
autolink_bbcode_includephp.zip [1.36kB / 337 Downloads]

How to fix it.

PHP-Fusion V7.02.07
razin attached the following file:
1_6.png [13.63kB / 48 Downloads]
Following this post, https://www.php-fusion.co.uk/forum/viewthread.php?thread_id=35185&pid=201117#post_191983
following post
Thread Information
16 posts
5949 times
Last Post
Last updated on 3 years ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Falk, janmol, KFJ, Homdax, Craig, Ralph68, Chan, Woody, razin, Rimelek