#32262 [NEW]: make require accept wildcards
From: jtaal at eljakim dot nl
Operating system: Linux
PHP version: 4.3.10
PHP Bug Type: Feature/Change Request
Bug description: make require accept wildcards
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);
}
}
--
Edit bug report at http://bugs.php.net/?id=32262&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32262&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32262&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32262&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32262&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32262&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32262&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32262&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32262&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32262&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32262&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32262&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32262&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32262&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32262&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32262&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32262&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32262&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32262&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32262&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32262&r=mysqlcfg
Thread (5 messages)
- jtaal at eljakim dot nl