Home » File System » File_Find » Bug #2132
Doc state &search() can be called statically. It isn't true.
Details
| Submitted | 2004-08-16 11:02 UTC |
|---|---|
| From | techtonik at tut dot by |
| Assigned | tuupola |
| Status | Closed |
| Package | File_Find |
| PHP Version | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2004-08-16 11:02 UTC] techtonik at tut dot by
Description:
------------
In documentation notes about
function &search ($pattern, $directory, $type='php');
--
Note
This function can be called statically.
--
It could't, because it uses other methods of the class, which in turn working with $this object instance. Here is a patch for that.
Expected result:
----------------
--- C:\httpd\.PHP\PEAR\File\Find.php.old Mon Aug 16 13:59:22 2004
+++ C:\httpd\.PHP\PEAR\File\Find.php Mon Aug 16 13:40:12 2004
@@ -194,6 +194,13 @@
* @access public
*/
function &search ($pattern, $directory, $type='php') {
+
+ // if called statically
+ if (!isset($this)) {
+ $obj = &new File_Find();
+ return $obj->search($pattern, $directory, $type);
+ }
+
$matches = array();
list (,$files) = File_Find::maptree($directory);
$match_function = File_Find::_determineRegex($pattern, $type);