From 3813a99bcce89dbbb16457f99a4cfdf131c3930d Mon Sep 17 00:00:00 2001 From: vSchoener Date: Wed, 19 Oct 2011 15:22:11 +0000 Subject: [PATCH] [-] CORE: Fix regex for isDate and isDateFormat (0000-00-00 00:00:00 is now allowed) --- classes/Validate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Validate.php b/classes/Validate.php index c5b390895..6c7bbcdca 100644 --- a/classes/Validate.php +++ b/classes/Validate.php @@ -428,7 +428,7 @@ class ValidateCore */ public static function isDateFormat($date) { - return (bool)preg_match('/^([0-9]{4})-((0?[0-9])|(1[0-2]))-((0?[1-9])|([0-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date); + return (bool)preg_match('/^([0-9]{4})-((0?[0-9])|(1[0-2]))-((0?[0-9])|([1-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date); } /** @@ -439,7 +439,7 @@ class ValidateCore */ public static function isDate($date) { - if (!preg_match('/^([0-9]{4})-((0?[1-9])|(1[0-2]))-((0?[1-9])|([1-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date, $matches)) + if (!preg_match('/^([0-9]{4})-((0?[0-9])|(1[0-2]))-((0?[0-9])|([1-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date, $matches)) return false; return checkdate((int)$matches[2], (int)$matches[5], (int)$matches[0]); }