php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #69383 Add glob_match() function
Submitted: 2015-04-06 13:32 UTC Modified: 2019-10-13 04:22 UTC
From: bschussek at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: Filesystem function related
PHP Version: 5.6.8RC1 OS: Ubuntu 14.04 LTS
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-04-06 13:32 UTC] bschussek at gmail dot com
Description:
------------
I'd love to see a function glob_match() that matches a path against a glob using 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_match(string $path, string $glob[, int $flags = 0])

$path - a file system path
$glob - a glob
$flags - the glob() flags

Result: true if the path matches, false otherwise

Test script:
---------------
<?php

var_dump(glob_match('css/style.css', '*/*.css'));
var_dump(glob_match('js/script.js', '*/*.css'));

Expected result:
----------------
true
false


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-06 13:33 UTC] bschussek at gmail dot com
-Type: Bug +Type: Feature/Change Request
 [2015-04-06 13:33 UTC] bschussek at gmail dot com
Changed type to feature request
 [2019-09-29 12:25 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2019-09-29 12:25 UTC] cmb@php.net
Are you looking for fnmatch[1]?

[1] <https://www.php.net/fnmatch>
 [2019-10-13 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Nov 13 14:01:29 2019 UTC