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

Bug #1236 bad regexp avoid format date
Submitted: 2004-04-18 09:46 UTC
From: chief at php dot net Assigned: pajoye
Status: No Feedback Package: Date
PHP Version: Irrelevant OS: n/a
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 : 36 - 33 = ?

 
 [2004-04-18 09:46 UTC] chief at php dot net
Description: ------------ I discovered that if you try to create new date with this format: $date = new Date('2003-07-15 22:53:37+01'); the current regexp doesn't match this. The correct regexop should be: preg_match('/^(\d{4})-?(\d{2})-?(\d{2})([T\s]?(\d{2}):?(\d{2}):?(\d{2})(Z|[\+\-]\d{2}):?(\d{2})?)?$/i', $date, $regs) best regards, Radek here is a full patch: Index: Date.php =================================================================== RCS file: /repository/pear/Date/Date.php,v retrieving revision 1.27 diff -r1.27 Date.php 147c147 < preg_match('/^(\d{4})-?(\d{2})-?(\d{2})([T\s]?(\d{2}):?(\d{2}):?(\d{2})(Z|[\+\-]\d{2}:?\d{2})?)?$/i', $date, $regs) --- > preg_match('/^(\d{4})-?(\d{2})-?(\d{2})([T\s]?(\d{2}):?(\d{2}):?(\d{2})(Z|[\+\-]\d{2}):?(\d{2})?)?$/i', $date, $regs) 165a166,168 > if(isset($regs[9])) { > $regs[8] += ':'.$regs[9]; > }

Comments

 [2004-05-12 10:06 UTC] aashley at optimiser dot com
umm sorry if this seems obvious to you, but how is this considered a bug? The ISO8601 standard says that timezone offset must be represented by 4 digits if it is present. IMHO the bug is actually in whatever code is trying to load a date with that format.
 [2004-05-16 11:41 UTC] paj at pearfr dot org
Hello, Please point me to the RFC related to this format. If there is none I do not see the point to allow this format. --Pierre
 [2005-03-07 04:00 UTC] dufuz
No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you.