From: <gem...@li...> - 2012-05-03 15:36:08
|
Revision: 661 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=661&view=rev Author: michieltcs Date: 2012-05-03 15:35:58 +0000 (Thu, 03 May 2012) Log Message: ----------- Prevent dates with a year > 9999 as this will cause errors when saving to the db Modified Paths: -------------- trunk/library/classes/MUtil/Validate/Date/IsDate.php Modified: trunk/library/classes/MUtil/Validate/Date/IsDate.php =================================================================== --- trunk/library/classes/MUtil/Validate/Date/IsDate.php 2012-05-03 14:37:07 UTC (rev 660) +++ trunk/library/classes/MUtil/Validate/Date/IsDate.php 2012-05-03 15:35:58 UTC (rev 661) @@ -72,7 +72,13 @@ */ public function isValid($value, $context = null) { - if (Zend_Date::isDate($value, $this->getDateFormat())) { + $date = new Zend_Date($value, $this->getDateFormat()); + + /** + * Prevent dates with a year > 9999 as this will cause errors + * when saving to the db + */ + if ($date->get(Zend_Date::YEAR) < 10000 && Zend_Date::isDate($date, $this->getDateFormat())) { return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |