The DirectoryIterator class has a bug that prevents regular files to be filtered against a file mask.
The DirectoryIterator::next function contains the following code:
// if recursive, we're not relying on the OS iterator to do the wildcard match, so do it now.. if (matches && isRecursive) matches = fileMatches (wildCards, filename);
...that should be changed to:
// if recursive, we're not relying on the OS iterator to do the wildcard match, so do it now..
if (matches && ((isDirectory && isRecursive) || !isDirectory))
matches = fileMatches (wildCards, filename);
I hope this fix is useful, Julian.
Best regards.