From 510b7817629e2d4231d6ca949b69b2a7b265ab5a Mon Sep 17 00:00:00 2001 From: iglocska Date: Wed, 20 Mar 2019 13:10:53 +0100 Subject: [PATCH] fix: [freetext] Stop parsing dates as phone numbers --- app/Lib/Tools/ComplexTypeTool.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Lib/Tools/ComplexTypeTool.php b/app/Lib/Tools/ComplexTypeTool.php index 79d262e8c..8dfa9aded 100644 --- a/app/Lib/Tools/ComplexTypeTool.php +++ b/app/Lib/Tools/ComplexTypeTool.php @@ -352,7 +352,7 @@ class ComplexTypeTool // Phone numbers - for automatic recognition, needs to start with + or include dashes if (!empty($input['raw'])) { if ($input['raw'][0] === '+' || strpos($input['raw'], '-')) { - if (preg_match("#^(\+)?([0-9]{1,3}(\(0\))?)?[0-9\/\-]{5,}[0-9]$#i", $input['raw'])) { + if (!preg_match('#^[0-9]{4}-[0-9]{2}-[0-9]{2}$#i', $input['raw']) && preg_match("#^(\+)?([0-9]{1,3}(\(0\))?)?[0-9\/\-]{5,}[0-9]$#i", $input['raw'])) { return array('types' => array('phone-number', 'prtn', 'whois-registrant-phone'), 'categories' => array('Other'), 'to_ids' => false, 'default_type' => 'phone-number', 'value' => $input['raw']); } }