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.

CommentFileSizeAuthor
file.inc_.file_scan_directory.patch641 bytesrinogo

Comments

drumm’s picture

Version: 5.3 » 7.x-dev
Status: Needs review » Needs work

I 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.

drewish’s picture

If 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.

drewish’s picture

Anonymous’s picture

Status: Needs work » Needs review
dave reid’s picture

This will be completed when #64967: Replace ereg with preg is completely fixed. Should we mark as duplicate?

Anonymous’s picture

Status: Needs review » Closed (duplicate)