Issues

ZF-5753: Zend_Date returns Week number with 2 digits

Description

With SVN14051:


require_once 'Zend/Date.php';
$date = new Zend_Date(1234567890); // => 2009-02-14
echo $date->toString('w');

This echoes '07' instead of '7' (based on http://framework.zend.com/manual/en/…).

In Zend_Date, line 843:


// week formats
case self::WEEK :
    return $this->date('W', $this->getUnixTimestamp(), false);
    break;

With newer PHP versions, 'W' is always return with 2 digits (see http://bugs.php.net/bug.php?id=34302 resolved in PHP 5.1.0).

Based on ISO8601, we must have 2 digits, so I think we should remove the possibility of only one digit since it does not function.

Comments

Wrong behaviour of PHP fixed with r14060