php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30564 existing files not seen (not existant)
Submitted: 2004-10-26 16:40 UTC Modified: 2004-11-13 01:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: cherub at dagservice dot nl Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.0.1 OS: Windows XP SP2
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-10-26 16:40 UTC] cherub at dagservice dot nl
Description:
------------
I used the script below to generate a filename, and check if it already exists useing file_exists (block 1). It generates the following output: "File 'C:\Program Files\Apache Group\Apache2\htdocs\aanleverwizard/temppics/e88d28551c277889a0b34b4b2135d348/pic0.png' does not exist!". However, when I copy/paste this to the windows run dialog, it actually is executed, so the file does exist!

I also tried replacing the file_exists function with a replacement function (block 2), but that also doesn't work...

Reproduce code:
---------------
//BLOCK 1: REPRODUCE FILE_EXISTS BUG
$Teller = 0;
$TestFile = getcwd(). '/temppics/'. session_id(). '/pic'. $Teller. '.png';
if (file_exists($TestFile)){
    echo('File \''. $TestFile. '\' exists!<BR>');
} else {
    echo('File \''. $TestFile. '\' does not exist!<BR>');
}
// BLOCK2: ALTERNATIVE TO FILE_EXISTS FUNCTION
	if (!function_exists('file_does_exist')){
		function file_does_exist($FileName){
			if (glob($FileName)){
				return true;
			} else return false;
		}
	}

Expected result:
----------------
I expect file_exists to return true, but it does not. I did verify that the file does actually exist.

Actual result:
--------------
// see description.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-04 13:49 UTC] tony2001@php.net
Please provide a complete example script, so we can just run it and see the problem.
 [2004-11-13 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-08-07 19:12 UTC] vyacheslav dot petrov at yahoo dot com
Hello,

I'm using "ApacheFriends XAMPP (basic package) version 1.6" (includes php 5.2.6) on a Windows XP SP2 computer and experience the same problem when installing "MediaWiki v 1.12.0" script.

It requires "diff3.exe" file, so I put it to "c:\Program Files\diff\" folder and added the folder to "Path" environment variable. When I run the MediaWiki installation script, it states "Diff3 not found". However, if I put "diff3.exe" to "c:\Windows\", MediaWiki locates it and states "Diff3 found at ...".

I've examined the code and it appears as file_exists() function returns false if the path to the file contains spaces even if the path is correct.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 03:01:27 2024 UTC