Page MenuHomePhabricator
Paste P14423

Fix PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in extensions-external/awc-fr/forums/includes/gen_funk.php on line 70
ActivePublic

Authored by valerio.bozzolan on Feb 20 2021, 2:45 PM.
diff --git a/gen_funk.php b/gen_funk.php
index e71285d..1d5e769 100644
--- a/gen_funk.php
+++ b/gen_funk.php
@@ -68,9 +68,16 @@ There are a few places in the forum where text being passed should not be phase
so they are base64_encode where needed and then this function will convert them all back in the end.
*/
-
- $text = preg_replace('/'."@$id@".'([0-9a-zA-Z\\+\\/]+=*)'."@$id@".'/e', 'base64_decode("$1")', $text );
-
+ // hot patch
+ $text = preg_replace_callback(
+ '/'."@$id@".'([0-9a-zA-Z\\+\\/]+=*)'."@$id@".'/',
+ function ($matches) {
+ return base64_decode($matches[1]);
+ },
+ $text
+ );
+
+ return $text;
}
function awcf_hide_code2($post, $todo = 'hide'){

Event Timeline

valerio.bozzolan changed the title of this paste from Fix PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in inextensions-external/awc-fr/forums/includes/gen_funk.php on line 70 to Fix PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in extensions-external/awc-fr/forums/includes/gen_funk.php on line 70.Feb 20 2021, 3:06 PM
valerio.bozzolan edited the content of this paste. (Show Details)