Latest CVS crashes on Win32 with Directory Functions
| From: | Sebastian Bergmann | Date: | Thu, 26 Jul 2001 10:27:17 +0000 |
| Subject: | Latest CVS crashes on Win32 with Directory Functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-61046@lists.php.net to get a copy of this message | ||
This script
<?php
$test = scan_directory('g:/', $files);
function scan_directory($directory, &$files) {
$handle = opendir($directory);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
if (!@is_dir($directory . $file)) {
if (substr($file, -3) == 'mp3') {
$files[] = $directory . '//' . $file;
}
} else {
scan_directory($directory . $file, $files);
}
}
}
closedir($handle);
}
?>
gives error messages like
Warning: OpenDir: Invalid argument (errno 22) in
e:\server\htdocs\test.php on line 5
Warning: Supplied argument is not a valid Directory
resource in e:\server\htdocs\test.php on line 7
and then crashes with an 'unknown software exception'.
Configuration: PHP 4 built from latest CVS as CGI on Win32.
The scan_directory() function worked fine, back when I wrote it -
which was some weeks ago.
--
Sebastian Bergmann Measure Traffic & Usability
http://sebastian-bergmann.de/ http://phpOpenTracker.de/