I'm working with some of the filesystem functions and have been running into errors. It would seem that the filetype() and is_dir() functions are not recieving proper information from the filesystem. Here is an example directory listing:
[ System is running FreeBSD 4.2, Apache 1.3.14 and PHP 4.0.3PL1 w/ ZendOptimizer ]
-rw-r--r-- 1 web web 310 Dec 15 17:27 blank.html
-rw-r--r-- 1 web web 312 Dec 15 17:27 blank2.html
-rw-r--r-- 1 web web 312 Dec 15 17:27 blank3.html
-rw-r--r-- 1 web web 2102 Dec 15 17:27 cache.html
drwxr-xr-x 2 web web 512 Dec 10 12:39 images
-rw-r--r-- 1 web web 520 Dec 15 17:27 index.html
drwxr-xr-x 2 web web 512 Dec 10 12:39 javascript
-rw-r--r-- 1 web web 6677 Dec 15 17:27 leftnav.html
-rw-r--r-- 1 web web 3148 Dec 15 17:27 main.html
-rw-r--r-- 1 web web 3661 Dec 15 17:27 news.html
-rw-r--r-- 1 web web 26349 Dec 15 17:27 tableLib.html
drwxr-xr-x 2 root web 512 Dec 16 13:20 testdir
-rw-r--r-- 1 web web 2620 Dec 15 17:27 top.tmpl
-rw-r--r-- 1 web web 497 Dec 15 17:27 top_ie.css
-rw-r--r-- 1 web web 451 Dec 15 17:27 top_ns.css
-rw-r--r-- 1 web web 134 Dec 15 17:27 tsum.php
Some simple code such as this:
$handle=opendir('/home/web/html/test.skel');
while ( false!==($file = readdir($handle)) )
{
if ( $file != "." && $file != ".." )
{
if (is_dir( $file ) ) {
print "$file is a directory.<BR>";
}
if (is_file($file) ) {
print "$file is a file.<BR>";
}
}
}
closedir($handle);
-- yields:
images is a directory.
index.html is a file.
top_ns.css is a file.
top_ie.css is a file.
tableLib.html is a file.
news.html is a file.
main.html is a file.
leftnav.html is a file.
cache.html is a file.
blank3.html is a file.
blank2.html is a file.
blank.html is a file.
tsum.php is a file.
notice how the test dir and javascript dirs are not listed? filetype() was returning null for those listings instead of directory.
Has anyone run across a problem like this before? I would appreciate any insight into this issue. Thanks!