From cf21b6c1a0c5e93eb6bfab28d3e492391e2d1a5b 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); }