Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0a4

Bug #19568 setDate() handles ISO week dates incorrectly
Submitted: 2012-08-16 18:13 UTC
From: stefan_melbinger Assigned: doconnor
Status: Closed Package: Date (version 1.5.0a2)
PHP Version: Irrelevant OS: Windows
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 22 + 1 = ?

 
 [2012-08-16 18:13 UTC] stefan_melbinger (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.

Comments

 [2012-08-16 18:18 UTC] stefan_melbinger (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-09-02 17:00 UTC] doconnor (Daniel O'Connor)
-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.