php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24086 file_exists generates false error
Submitted: 2003-06-08 17:41 UTC Modified: 2003-06-26 18:20 UTC
From: danfratus at attbi dot com Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 4.3.2 OS: Windows XP Professional
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-06-08 17:41 UTC] danfratus at attbi dot com
<?
if (file_exists("$file") && $file != "." && $file != "..")
{ 
$file = join('',file($file));
echo "$file";
}
?>

Ok the glitch is this: if $file is "." or ".." the script is fine, no errors are generated, but, when $file is "..." or "......." or "..................", etc. then for some reason PHP reconizes this as a directory, yet it can't be included therefore generating this error: 

---
Warning: file(...) [function.file]: failed to create stream: No such file or directory in F:\server\bug.php on line 4

Warning: join() [function.join]: Bad arguments. in F:\server\bug.php on line 4
---

This "bug" isn't going to crash the entire internet or anything, but it should be fixed.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-09 08:38 UTC] sniper@php.net
Exactly what is the bug here? file_exists("...") ??
or what? (that returns FALSE..)

 [2003-06-15 23:45 UTC] sniper@php.net
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.


 [2003-06-16 02:17 UTC] danfratus at attbi dot com
No feedback is necessary, the bug submission is strait forward.  if(file_exists("...")) generates errors.
 [2003-06-16 03:13 UTC] derick@php.net
Where is the bug? I don't see anything in your report that is not correct...
 [2003-06-16 03:26 UTC] danfratus at attbi dot com
PHP Falsely recognizes "..." as a valid directory, then triest to use this, but obviously it cannot since it isn't a valid directory.

For instance: 
if (file_exists("$file") && $file != "." && $file != "..")
Filesystems recognize "." and ".." as directories, but filesystems do not recognize "..." as a directory, PHP _DOES_, this is the glitch.  If in the above code $file is "..." PHP generates an error.  I can't make it anymore clear than that.
 [2003-06-16 03:27 UTC] derick@php.net
You're saying you have a file with a name '...' ?

Derick
 [2003-06-26 18:20 UTC] sniper@php.net
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-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC