Req #69384 [NEW]: Add glob_filter() function
| From: | bschussek at gmail dot com | Date: | Mon, 06 Apr 2015 13:38:31 +0000 |
| Subject: | Req #69384 [NEW]: Add glob_filter() function | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-191845@lists.php.net to get a copy of this message | ||
From: bschussek at gmail dot com
Operating system: Ubuntu 14.04 LTS
PHP version: 5.6.8RC1
Package: Filesystem function related
Bug Type: Feature/Change Request
Bug description:Add glob_filter() function
Description:
------------
I'd love to see a glob_filter() function that filters an array of file
paths for those file paths matching a glob, with the same rules used by
glob(). This function is needed when a virtual file system (implemented
in PHP) should be globbed for files.
Signature:
glob_filter(array $paths, string $glob[, int $flags = 0])
$paths - an array of file system paths
$glob - a glob
$flags - the glob() flags
Result: an array of matching file system paths
Test script:
---------------
$input = array(
'/css',
'/css/reset.css',
'/css/style.css',
'/js',
'/js/script.js',
);
foreach (glob_filter($input, '/*/*.css') as $path) {
echo $path."\n";
}
Expected result:
----------------
/css/reset.css
/css/style.css
--
Edit bug report at https://bugs.php.net/bug.php?id=69384&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69384&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69384&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69384&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69384&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69384&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69384&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69384&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69384&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69384&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69384&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69384&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69384&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69384&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69384&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69384&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69384&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69384&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69384&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69384&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69384&r=mysqlcfg