Commit f24c5ecb authored by Jorgen's avatar Jorgen

Add preg_quote invokation to secure input data

parent 308b40b8
...@@ -71,6 +71,9 @@ abstract class TyposClientInterface ...@@ -71,6 +71,9 @@ abstract class TyposClientInterface
// Strip all tags from text // Strip all tags from text
$text = strip_tags($article->text); $text = strip_tags($article->text);
$context = preg_quote($context);
$typo = preg_quote($typo);
// Find all typos in text, capture an offset of each typo // Find all typos in text, capture an offset of each typo
$typos = []; $typos = [];
preg_match_all("#{$typo}#", $text, $typos, PREG_OFFSET_CAPTURE); preg_match_all("#{$typo}#", $text, $typos, PREG_OFFSET_CAPTURE);
...@@ -80,8 +83,6 @@ abstract class TyposClientInterface ...@@ -80,8 +83,6 @@ abstract class TyposClientInterface
$contextMatch = []; $contextMatch = [];
preg_match_all("#{$context}#", $text, $contextMatch, PREG_OFFSET_CAPTURE); preg_match_all("#{$context}#", $text, $contextMatch, PREG_OFFSET_CAPTURE);
error_log("Context match = " . print_r($contextMatch, true));
$contextMatch = $contextMatch[0]; $contextMatch = $contextMatch[0];
if (!isset($contextMatch[0])) { if (!isset($contextMatch[0])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment