zikula/core — Issue #198: Wrong checks in DateUtil::getDateFormatData
Author: Guite
Created: 2011-12-11 17:52:03+00:00
State: open

In DateUtil beginning with line 853 we have the following code:

// 8 = __('%Y-%m-%d');
// 14 = __('%Y-%m-%d %H:%M');
// 17 = __('%Y-%m-%d %h:%M:%S');
$length = strlen($dateformat);
switch ($length) {
case 8:
$regex = '#%(\w)(.)%(\w)(.)%(\w)#';
$type = 'date';
break;
case 14:
$regex = '#%(\w)(.)%(\w)(.)%(\w)\s%(\w)(.)%(\w)#';
$type = 'datetimeshort';
break;
case 17:
$regex = '#%(\w)(.)%(\w)(.)%(\w)\s%(\w)(.)%(\w)(.)%(\w)#';
$type = 'datetimefull';
break;
default:
z_exit(__f('Dateformat must be with 8, 14 or 17 characters long.', $dateformat));
}

Shouldn't these all these threshold values be incremented by 2?