[-] CORE: Fix regex for isDate and isDateFormat (0000-00-00 00:00:00 is now allowed)
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9471 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -428,7 +428,7 @@ class ValidateCore
|
|||||||
*/
|
*/
|
||||||
public static function isDateFormat($date)
|
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)
|
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 false;
|
||||||
return checkdate((int)$matches[2], (int)$matches[5], (int)$matches[0]);
|
return checkdate((int)$matches[2], (int)$matches[5], (int)$matches[0]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user