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 05:12 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 05: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 18:53 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!