Details
Description
$date = new Zend_Date();
$date->isEarlier(Zend_Date::now());
gives exception
Message: No date part in '' found.
#0 C:\WebServer\www\library\Zend\Date.php(1132): Zend_Date->_calculate('cmp', Object(Zend_Date), '', NULL)
#1 C:\WebServer\www\library\Zend\Date.php(2659): Zend_Date->compare(Object(Zend_Date), NULL, NULL)
...
fix:
public function compare($date, $part = null, $locale = null)
{
if (self::$_options['format_type'] == 'php') {
$part = Zend_Locale_Format::convertPhpToIsoFormat($part);
}
should be
public function compare($date, $part = null, $locale = null)
{
if (isset($part) && self::$_options['format_type'] == 'php') {
$part = Zend_Locale_Format::convertPhpToIsoFormat($part);
}
because null becames string(0) '' after convertPhpToIsoFormat()
—
Zend Framework 1.10.0.dev (from SVN)
Not reproducable with r18692