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

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

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: doconnor
This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on pear.php.net
by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.




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

[2012-08-16 14:18:00] stefan_melbinger

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)

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

[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
postedSep 2, '12 at 12:00p
activeSep 2, '12 at 12:00p
posts1
users1
websitepear.php.net

1 user in discussion

Daniel Oconnor: 1 post

People

Translate

site design / logo © 2022 Grokbase