From f4d76d10b226ec48ce1b9973c963c485d64ddf1d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 15 Feb 2018 22:13:45 -0500 Subject: [PATCH 1/2] Fix PHP Warning: preg_replace(): Compilation failed in include/items --- include/items.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/items.php b/include/items.php index 31c8aaa799..740376a1ee 100644 --- a/include/items.php +++ b/include/items.php @@ -186,7 +186,7 @@ function add_page_info_to_body($body, $texturl = false, $no_photos = false) { } $url = str_replace(['/', '.'], ['\/', '\.'], $matches[1]); - $removedlink = preg_replace("/\[url\=" . $url . "\](.*?)\[\/url\]/ism", '', $body); + $removedlink = preg_replace("/\[url\=" . preg_quote($url) . "\](.*?)\[\/url\]/ism", '', $body); if (($removedlink == "") || strstr($body, $removedlink)) { $body = $removedlink; } From 31831b9fdbadeb91c26a3631ca62ebb51900d971 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 16 Feb 2018 00:31:32 -0500 Subject: [PATCH 2/2] Remove partial preg_quote in include/items --- include/items.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/items.php b/include/items.php index 740376a1ee..1e4fe3ea01 100644 --- a/include/items.php +++ b/include/items.php @@ -185,8 +185,7 @@ function add_page_info_to_body($body, $texturl = false, $no_photos = false) { $body = $removedlink; } - $url = str_replace(['/', '.'], ['\/', '\.'], $matches[1]); - $removedlink = preg_replace("/\[url\=" . preg_quote($url) . "\](.*?)\[\/url\]/ism", '', $body); + $removedlink = preg_replace("/\[url\=" . preg_quote($matches[1]) . "\](.*?)\[\/url\]/ism", '', $body); if (($removedlink == "") || strstr($body, $removedlink)) { $body = $removedlink; }