php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74081 question about function: file_exists()
Submitted: 2017-02-10 20:28 UTC Modified: 2017-02-11 07:59 UTC
From: louvetj3 at outlook dot fr Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.6.30 OS: WIN10 / WAMP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: louvetj3 at outlook dot fr
New email:
PHP Version: OS:

 

 [2017-02-10 20:28 UTC] louvetj3 at outlook dot fr
Description:
------------
What is behavior of function file_exists($filename) if a version number is added to filename ie: $filename='myFile.css?ver=09022017'; 
it seems that some times version number is 
taken as part of fileName some times not.


directory: wcommander
file name: myFile.css
see script below

---
From manual page: http://www.php.net/function.file-exists
---


Test script:
---------------
$fileName= 'myFile.css?ver=09022017';
$repertoire = array('wcommander','wmembres','wactualites');
$root = (__DIR__);
$resultat = $fileName;
foreach($repertoire as $key => $value)
{
	if(file_exists($root.'/'.$value.'/'.$fileName))
		$resultat = $value.'/'.$fileName;
}
echo $resultat;



Expected result:
----------------
wcommander/myFile.css?ver=09022017

Actual result:
--------------
it seems that file is found because of version number

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-11 07:59 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Type: Documentation Problem +Type: Bug -Package: Website problem +Package: Filesystem function related
 [2017-02-11 07:59 UTC] requinix@php.net
? is only special for URLs. If you're testing normal files then you have to have one actually named "myFile.css?ver=09022017", which is not possible to do on Windows.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Dec 02 21:01:25 2020 UTC