Zend Framework

Zend_Date::compare bug

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Critical Critical
  • Resolution: Cannot Reproduce
  • Affects Version/s: Next Major Release
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Date
  • Labels:
    None

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)

Activity

Hide
Thomas Weidner added a comment -

Not reproducable with r18692

Show
Thomas Weidner added a comment - Not reproducable with r18692

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: