file_scan_directory's $mask is case sensitive (it uses ereg()). It should really be case INsensitive, so that when searching for '.htm', files with extensions of HTM, htm, Html, HTML, etc. are all returned. However, this does means that if using a $mask of 'a', then both 'a.txt' and 'A.txt' will be returned (in other words, remember that this effects the search behavior *always*,not just when searching with an extension).
Regardless of the drawbacks, I think this is a change worth considering.
| Comment | File | Size | Author |
|---|---|---|---|
| file.inc_.file_scan_directory.patch | 641 bytes | rinogo |
Comments
Comment #1
drummI would consider this to be a minor API change. The patch should be written for the current development version and reviewed there. If committed, a backport may be possible, but unlikely since this does affect API behavior.
Comment #2
drewish commentedIf we're going to break the BC I'd rather use preg_match because then you could use '/a\.html/i' and have the caller determine if they want it case sensitive or not.
Comment #3
drewish commentedmarked #306957: file_scan_directory - case insensitive scans as a duplicate
Comment #4
Anonymous (not verified) commentedhttp://drupal.org/files/issues/file_scan_directory_insensitive.patch is a 7.x-dev patch attached to the #306957: file_scan_directory - case insensitive scans duplicate.
Comment #5
dave reidThis will be completed when #64967: Replace ereg with preg is completely fixed. Should we mark as duplicate?
Comment #6
Anonymous (not verified) commented#64967: Replace ereg with preg