Issues

ZF-12095: CLONE - Zend_Date::setOptions(array('format_type' => 'php')) breaking Zend_Date

Description

<?php require_once 'Zend/Date.php';

Zend_Date::setOptions(array('format_type' => 'php')); $d = new Zend_Date(); $d->set('00:00:00', Zend_Date::TIMES); // This is throwing an exception

/* Fatal error: Uncaught exception 'Zend_Locale_Exception' with message 'Unknown date format, neither date nor time in 'wwww' found' in /opt/php/ZendFramework-1.11.10/library/Zend/Date.php on line 2665

Zend_Locale_Exception: Unknown date format, neither date nor time in 'wwww' found in /opt/php/ZendFramework-1.11.10/library/Zend/Locale/Format.php on line 849

Call Stack: 0.0001 329124 1. {main}() /var/www/bug.php:0 0.0235 3416460 2. Zend_Date->set() /var/www/bug.php:6 0.0236 3416724 3. Zend_Date->_calculate() /opt/php/ZendFramework-1.11.10/library/Zend/Date.php:1078 0.0243 3417796 4. Zend_Locale_Format::getDate() /opt/php/ZendFramework-1.11.10/library/Zend/Date.php:2629 0.0243 3418604 5. Zend_Locale_Format::_parseDate() /opt/php/ZendFramework-1.11.10/library/Zend/Locale/Format.php:1118

Zend_Date_Exception: Unknown date format, neither date nor time in 'wwww' found in /opt/php/ZendFramework-1.11.10/library/Zend/Date.php on line 2665

Call Stack: 0.0001 329124 1. {main}() /var/www/bug.php:0 0.0235 3416460 2. Zend_Date->set() /var/www/bug.php:6 0.0236 3416724 3. Zend_Date->_calculate() /opt/php/ZendFramework-1.11.10/library/Zend/Date.php:1078 */

Comments

This Issue was marked as closed last time I submitted as not an issue. But IMO the fact the code example I posted breaks when using format_type php means the API is broken. At the very least the documentation should be reflected to show you can't use any of the constants when using format_type php, and it should show you how to set parts of the date when using format_type php

Linking back to original issues. Flagged for review by ZF CR Team.