[-] Core: Fix isDate validator

This commit is contained in:
Rémi Gaillard
2012-12-03 16:52:22 +01:00
parent 0f3bbaf65c
commit 6ddd3a03bb
+2 -2
View File
@@ -472,9 +472,9 @@ class ValidateCore
*/
public static function isDate($date)
{
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))
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]);
return checkdate((int)$matches[2], (int)$matches[3], (int)$matches[1]);
}
/**