From 8986d2460b17c980f5b750dbe588f3717da5fa14 Mon Sep 17 00:00:00 2001 From: oliver Date: Sun, 31 Jan 2016 17:21:11 +0100 Subject: [PATCH] Stationtype ?keyword?: check regex --- stationtypes/keyword/KeywordStationtypeController.inc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stationtypes/keyword/KeywordStationtypeController.inc b/stationtypes/keyword/KeywordStationtypeController.inc index cf219885..c5a2609b 100644 --- a/stationtypes/keyword/KeywordStationtypeController.inc +++ b/stationtypes/keyword/KeywordStationtypeController.inc @@ -157,9 +157,16 @@ */ private function isMatching($regex, $answer) { + // Check regex + if(empty($regex)) { + return false; + } + + // Execute regex $score = preg_match($regex, trim($answer)); + // Return result return ($score !== false && $score > 0); }