From d2ea385c2696c10c598c07136cb8198cfc94406a Mon Sep 17 00:00:00 2001 From: Khushbu Fuletra Date: Tue, 2 Jun 2020 19:16:11 +1000 Subject: [PATCH] fix(deprecateError): Function create_function is deprecated in php7.2 --- src/Form/SiteSearchForm.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Form/SiteSearchForm.php b/src/Form/SiteSearchForm.php index b034696..2e9a0e1 100644 --- a/src/Form/SiteSearchForm.php +++ b/src/Form/SiteSearchForm.php @@ -34,12 +34,13 @@ public function getResults($pageLength = null, $data = null) $keywords = $data['Search']; - $andProcessor = create_function('$matches', ' - return " +" . $matches[2] . " +" . $matches[4] . " "; - '); - $notProcessor = create_function('$matches', ' - return " -" . $matches[3]; - '); + $andProcessor = function ($matches) { + return " +" . $matches[2] . " +" . $matches[4] . " "; + }; + + $notProcessor = function ($matches) { + return " -" . $matches[3]; + }; $keywords = preg_replace_callback('/()("[^()"]+")( and )("[^"()]+")()/i', $andProcessor, $keywords); $keywords = preg_replace_callback('/(^| )([^() ]+)( and )([^ ()]+)( |$)/i', $andProcessor, $keywords);