Error 8192: preg_replace()

Started by MESWEB, June 21, 2014, 01:25:55 PM

Previous topic - Next topic

MESWEB

I have error:
8192: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Illori

have you upgraded to 2.0.8? if not do so.

MESWEB



margarett

Can you point the complete log, that indicates a file and a line number? Also, please attach the affected file ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

MESWEB

#5
http://obeznany.pl/index.php?topic=10.msg16
8192: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
File: /home/*l/public_html/Sources/Facebook/FacebookHooks.php
Linia: 173 & 174

margarett

Well, that's a mod, not SMF core so we can't do anything about it, really :(
The author should update the code for PHP 5.5+ compliance...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

br360

Quote from: margarett on June 21, 2014, 02:43:22 PM
Well, that's a mod, not SMF core so we can't do anything about it, really :(
The author should update the code for PHP 5.5+ compliance...

Couldn't he just change  preg_replace to preg_replace_callback in any instance it occurs in that FacebookHooks.php file?

Kindred

I don't think it's quite that simple.

Many mod authors are going to have this issue soon...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Antes

I masked the full path because of security reasons :)

br360

Quote from: Kindred on June 21, 2014, 03:33:02 PM
Many mod authors are going to have this issue soon...

There lies the problem though. There are mods here that people have come to use and rely on that are no longer supported by the mod authors. If this is something that may start happening to a lot of mods that haven't been updated for newer versions of php, what suggestions are out there for people to be able to possibly fix this themselves?

MESWEB

Author of this mod say: "Don't know when release update"

Kindred

I am sorry to say, however, that issues with mod code or mods being deprecated are not smf support issues.

Since you are looking for a coding fix, I'll move this out of support, since it is not, and into coding...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

kat

They'll be in the same position that Windows users are in, whenever Micro$oft update Windows and people's fave programs don't work... :(

jm_araujo

#14
Today I've found out my error logs full with this error (a little over 200k entries)  because of facebookhooks.php
Google took me to this thread but no solution, so I've had to make my own.
I've changed the lines 173&174:
$cleaned[0]['body'] = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $cleaned[0]['body']);
$cleaned[0]['body'] = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $cleaned[0]['body']);

To:
$cleaned[0]['body'] = preg_replace_callback('~&#x([0-9a-f]+);~i',
    function ($matches) {
        return chr(hexdec($matches[0]));
    },
    $cleaned[0]['body']);

$cleaned[0]['body'] = preg_replace_callback('~&#([0-9]+);~',
    function ($matches) {
        return chr($matches[0]);
    },
    $cleaned[0]['body']);


And now my log is error free!!
I also attach the modified FacebookHooks.php

Kindred

That may cause additional issues.

Also, removed the attachment since the mod license doesn't allow redistribution of the files.  You should also be posting the the support topic for the mod...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: