[PHP-DEV] PHP 4.0 Bug #8674: invallid filetype() results (affects isdir() )

2001-01-12 Thread yavo

From: [EMAIL PROTECTED]
Operating system: redhat 6.2
PHP version:  4.0.4
PHP Bug Type: Filesystem function related
Bug description:  invallid filetype() results (affects isdir() )

im using php for shell scripting in redhat 6.2. compiled with 
'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-oci8=/usr/local/oracle'

trying to get the filetype files returns null for all entries exsept . and .. . 

-- code snippet -- 
  $dp = opendir($dir);
  if($dp){
while (($file = readdir($dp))!== false) {
  // Skip . and .. and check for type
  // tried with this on and both here and at the start
  clearstatcache();
  print($file." - ".filetype($file)."\n");
 
  if(($file != ".")  ($file != "..")  (filetype($file) == $type)){
$files[] = $file;
  }
}//while
return($files);
  }//if
  else{
debug("The directory [$dir] was not found or couldn't be opened");
write_log("The directory [$dir] was not found or couldn't be opened");
return(0);
  }
-- end of snippet -


-- 
Edit Bug report at: http://bugs.php.net/?id=8674edit=1



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] PHP 4.0 Bug #8674: invallid filetype() results (affects isdir() )

2001-01-12 Thread Sean R. Bright

Thats because you need to pass a valid filename to filetype().  PHP is
trying to find $file in its current directory even if $dir is
/usr/local/not/phps/current/dir.  I have fixed your example below.  (Note
that this still won't work if the last character of $dir is not a '/', so
append one where necessary)

(I think this bug can be closed also.)

Sean
==
Sean Bright
[EMAIL PROTECTED] / [EMAIL PROTECTED]
==

   ...
   // tried with this on and both here and at the start
   clearstatcache();

// UPDATED : Try this
print($file." - ".filetype($dir . $file)."\n"); // Notice the
concatenation.

   if(($file != ".")  ($file != "..") 
   ...


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]