php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25343 Is_Dir() gives warning
Submitted: 2003-09-01 08:20 UTC Modified: 2003-09-01 20:23 UTC
From: patric at liefdeis dot com Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.3.3 OS: FreeBSD 4.3
Private report: No CVE-ID: None
 [2003-09-01 08:20 UTC] patric at liefdeis dot com
Description:
------------
When I run is_dir() on FreeBSD 4.3, and the file I check is not a dir, I get a warning, about that the file is not a dir (duh, that is what I am checking for :p). On Windows systems I don't have this problem.
Temporary solved the problem by using @is_dir(). But I believe it is not very logic.

Reproduce code:
---------------
if (is_dir("file.txt")) {
  echo "This shouldn't be a dir";
} else {
  echo "burp";
}

Expected result:
----------------
burp

Actual result:
--------------
Warning: is_dir(): Stat failed for /www/site/file.txt (errno=20 - Not a directory) in /www/site on line 1
burp

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-01 20:23 UTC] sniper@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 12:01:27 2024 UTC