PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » File System » File_Find » Bug #2132

Doc state &search() can be called statically. It isn't true.

Details

Submitted2004-08-16 11:02 UTC
Fromtechtonik at tut dot by
Assignedtuupola
StatusClosed
PackageFile_Find
PHP VersionIrrelevant
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);