--- includes/file.inc.orig.inc	2010-08-10 20:32:14.000000000 +0200
+++ includes/file.inc	2010-08-10 20:32:06.000000000 +0200
@@ -923,7 +923,7 @@
           // Give priority to files in this folder by merging them in after any subdirectory files.
           $files = array_merge(file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1), $files);
         }
-        elseif ($depth >= $min_depth && ereg($mask, $file)) {
+        elseif ($depth >= $min_depth && preg_match('/' . $mask . '/', $file)) {
           // Always use this match over anything already set in $files with the same $$key.
           $filename = "$dir/$file";
           $basename = basename($file);
