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

Request #712 File_Find::search() matches REGEX against fullpath
Submitted: 2004-02-09 14:31 UTC
From: mike Assigned: tuupola
Status: Closed Package: File_Find
PHP Version: Irrelevant OS: Irrelevant
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 - 3 = ?

 
 [2004-02-09 14:31 UTC] mike
Description: ------------ File_Find::search() matches supplied REGEX against the full path of the entries. There should at least be a switch to define whether the REGEX should be matched against the full path or only the filename.

Comments

 [2004-02-11 12:39 UTC] mike
Here comes the patch: --- e:\MyTemp\Tortoise1732.rev.1.5-Find.php 2003-01-03 16:25:35.000000000 +0100 +++ W:\WWW\mike\pear\File_Find\Find.php 2004-02-11 13:36:23.656250000 +0100 @@ -185,6 +185,9 @@ * * @param string $type the type of regular expression support to use, either * 'php' or 'perl'. + * + * @param bool $fullpath whether the regex should be matched against the + * full path or only against the filename * * @return array a list of files matching the pattern parameter in the the * directory path specified by the directory parameter @@ -192,7 +195,7 @@ * @author Sterling Hughes <sterling@php.net> * @access public */ - function &search($pattern, $directory, $type = 'php') + function &search($pattern, $directory, $type = 'php', $fullpath = true) { $matches = array(); list (,$files) = File_Find::maptree($directory); @@ -200,7 +203,7 @@ reset($files); while (list(,$entry) = each($files)) { - if ($match_function($pattern, $entry)) + if ($match_function($pattern, $fullpath ? $entry : basename($entry))) $matches[] = $entry; } Ciao, Mike
 [2004-07-11 22:05 UTC] gurugeek
Dear Maintainer, Your package file_find has currently 1 open bug. We urge you to take the necessary steps to solve the reported issues at your soonest convenience. If the bug issue hasn’t been addressed yet you are kindly asked to take the necessary steps to ensure a prompt resolution of the problem. If you already addressed the reported problem feel free to change the bug status as soon as possible. Regards David Costa PEAR Quality Assurance pear-qa@lists.php.net
 [2004-08-18 10:27 UTC] tuupola
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.