FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=19568&edit=1

ID: 19568
Comment by: stefan.melbinger@gmail.com
Reported By: stefan dot melbinger@gmail.com
Summary: setDate() handles ISO week dates incorrectly
Status: Open
Type: Bug
Package: Date
Operating System: Windows
Package Version: 1.5.0a2
PHP Version: Irrelevant
Roadmap Versions:
New Comment:

Solution:

Replace
'W(0[1-9]|[1-4][0-9]|5[1-3])-?([1-7])|' . // ISO week date

with
'W(0[1-9]|[1-4][0-9]|5[0-3])-?([1-7])|' . // ISO week date

in Date.php:setDate($date, $format, $pb_repeatedhourdefault)


Previous Comments:
------------------------------------------------------------------------

[2012-08-16 14:13:42] stefan_melbinger

Description:
------------
setDate() uses the following regular expression to check for valid ISO
week date input:

'W(0[1-9]|[1-4][0-9]|5[1-3])-?([1-7])|' . // ISO week date

This excludes week number 50, resulting in a PEAR error.

Test script:
---------------
$x = new Date('2012-W49-1');
var_dump($x);

$x = new Date('2012-W50-1');
var_dump($x);

$x = new Date('2012-W51-1');
var_dump($x);


Expected result:
----------------
All 3 dates should be instantiated correctly.

Actual result:
--------------
The date with week number 50 is not instantiated correctly because the
input string is rejected by the regular expression.

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedAug 16, '12 at 12:11p
activeAug 16, '12 at 12:11p
posts1
users1
websitepear.php.net

1 user in discussion

Stefan Melbinger: 1 post

People

Translate

site design / logo © 2022 Grokbase