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

Bug #9998 Regular Expression Matching For List
Submitted: 2007-02-01 00:12 UTC Modified: 2007-09-17 13:53 UTC
From: bjcullinan at gmail dot com Assigned: clay
Status: Closed Package: VersionControl_SVN (version 0.3.0alpha1)
PHP Version: 4.4.4 OS: Linux, Ubuntu Server
Roadmaps: 0.3.1    
Subscription  


 [2007-02-01 00:12 UTC] bjcullinan at gmail dot com (brian)
Description: ------------ I am using a recent version of Pear. I just installed it about 3 weeks ago. Also using the latest version of this library. The error presented itself when I used it on my subversion server. I have a series of directories with names that include numbers surrounded by spaces. For example my computer science homework is titled 'CS 200 HW 1'. Using the list command when matching the output from the command in verbose mode the section that matches the date includes part of the name 'CS 200' so the output looks like 'Jan 20 11:30 CS 200' followed by the match for the folder name 'HW 1' as you can see this would not be correct. This error may apply to other commands, I have only tested the list command on my server. The error occurs near line 347 in the List.php file. here is the code that caused this error. foreach ($items as $item) { // Regex should work with svn list's "%b %d %H:%M" and "%b %d %Y" date formats preg_match("/\s*(\d+) (\S+)\s+(\d+)? (\w{3}.+\d{2}) (.*)/", $item, $matches); This can be fixed by making the regular expression more specific to the date. Also sometimes the subversion is missing the author, in which case it prints and extra space and a question mark where the authors name should be. Both errors are fixed in the code below. preg_match("/\s*(\d+) \s?(\S+)\s+(\d+)? (\w{3} +\d{2} +\d{2}:?\d{2}) (.*)/", $item, $matches); A question mark is used between the hour and minute after the ':' because some clients commit only the year to the file information, therefore the \d{2}\d{2} will still be matched correctly. Expected result: ---------------- The date matching from the list output should not match part of a file name that contains numbers surrounded by spaces.

Comments

 [2007-09-17 13:53 UTC] clay (Clay Loveless)
This bug has been fixed in CVS. 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.