php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #32262 make require accept wildcards
Submitted: 2005-03-10 12:13 UTC Modified: 2005-03-10 13:01 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: jtaal at eljakim dot nl Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.3.* OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jtaal at eljakim dot nl
New email:
PHP Version: OS:

 

 [2005-03-10 12:13 UTC] jtaal at eljakim dot nl
Description:
------------
I have a series of classes in PHP 4.3, there is no autoload feature there so I named all my files "class.$className.inc.php".
I created the class.inc.php file which require_onces all class.*.inc.php files.
This works fine for files which are inside the same directory as class.*.inc.php
BUT, when I include class.inc.php from another directory the `ls $wildcard` comes up empty, thus nothing is included.

Wouldn't it be a good feature to have a require_once_wildcard which includes files.
A problem that may rise is the includeSearchPath (in which directory should the wildcard be executed?). A solution is to execute only in the directory where the file resides which calls require_once_wildcard.

My source for require_once_wildcard is in the Reproduce code field.


Reproduce code:
---------------
function require_once_wildcard($wildcard) {
  $ls = `ls $wildcard`;
  $ls = explode("\n", $ls);
  array_pop($ls); // strip last empty line
  print_r($ls);
  foreach ($ls as $inc) {
    require_once($inc);
  }
}



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-10 12:19 UTC] helly@php.net
Sorry no new features in the 4.3 branch.
 [2005-03-10 12:45 UTC] jtaal at eljakim dot nl
will there be a 4.4 branch?
 [2005-03-10 12:56 UTC] johannes@php.net
No. 
 [2005-03-10 13:01 UTC] helly@php.net
We do not have plans for that. The only possibility would be after 5.1 is out and we find out it is quite stable enough to start a new war.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 10:01:32 2024 UTC