Skip to content

Commit

Permalink
Merge pull request #101 from KhushbuFuletra/fix-php7-2-create-functio…
Browse files Browse the repository at this point in the history
…n-deprecate-error

fix(deprecateError): Function create_function is deprecated in php7.2
  • Loading branch information
Nathan authored Jun 3, 2020
2 parents 7d99c5a + d2ea385 commit 9ead498
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Form/SiteSearchForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9ead498

Please sign in to comment.