|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11984 filetype function not working for non-existant files
Submitted: 2001-07-09 13:12 UTC Modified: 2002-09-26 20:05 UTC
Avg. Score:1.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: JSaunders at edis dot co dot uk Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 4.2.2 OS: Windows 98
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2001-07-09 13:12 UTC] JSaunders at edis dot co dot uk
Regression error from 4.0.5 to 4.0.6. Looks like using filetype on a non-existant file, returns the value of the last valid call. Seen on the pre-compiled win32 flavour download with all modules.

echo filetype("c:/zzzzzz.zzz");
echo filetype("c:/");
echo filetype("c:/zzzzzz.zzz");


<b>Warning</b>:  Unknown file type (0) in <b>-</b> on line <b>2</b><br>

on 4.0.6. The file zzzzzzz.zzz does not exist. 4.0.5 returns dir with no warning.

clearstatcache() has no effect. Have to explicitly check for file existance with file_exists under this release.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-13 23:54 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

 [2002-08-14 05:35 UTC] JSaunders at edis dot co dot uk
Tested this on 4.2.2 bug is still there. Would have fixed it myself but there was masses of change in the code that handles filetype between 4.0.5 and 4.0.6.

Better to look at the problem than arbitarily close entries more than n months old. The example isn't rocket science to retest. Remember 4.0.6 was the current release when I raised the bug!

 [2002-08-14 09:43 UTC]
Updating verison.

yes it's good to test bugs, but also please realize a lot of changes have occured including between 4.2.2 and the current CVS.  It wasn't a case of N months, it's more a case of version fixes.  And I do believe we just fixed this in CVS last week... can you try out a non-STABLE snapshot and see?
 [2002-08-15 03:42 UTC] JSaunders at edis dot co dot uk
Downloaded snap build, the problem still exists in this, but I can't reproduce it on Solaris (under 4.0.6). So suggests different handling of stat returns under win32/Solaris (filestat.c - php_stat).
Hope to look @ code and do static walkthrough as I don't have Windows compiler to hand.
 [2002-09-09 05:26 UTC]
Please try with PHP 4.2.3.

 [2002-09-26 20:05 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jan 26 18:01:23 2021 UTC