|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #63617 Make file_exists() case insensitive
Submitted: 2012-11-27 04:14 UTC Modified: 2012-11-27 05:09 UTC
Avg. Score:4.3 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: soapergem at gmail dot com Assigned:
Status: Wont fix Package: Filesystem function related
PHP Version: Irrelevant OS: *nix
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-11-27 04:14 UTC] soapergem at gmail dot com
Currently file_exists() is case insensitive on Windows, but not on *nix platforms. 
This makes it difficult to migrate from Windows back to *nix. Forcing 
file_exists() to always be case insensitive would be of great benefit in these 
scenarios. I'm not sure what the engineering behind it would involve, but I 
thought I'd ask!

Test script:

$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
var_dump(file_exists($dir . 'cAsE_mAtTeRs.php'));


Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-27 05:09 UTC]
PHP relies on the underlying semantics of the file system: if the file system is case insensitive (and some file systems are or optionally can be on *nix systems — for example, HFS+ on OS X), then PHP will behave accordingly.

Having PHP behave differently to other programs on the same system would definitely violate the principle of least surprise, quite aside from the (non-trivial) amount of work required.

Closing Won't Fix.
 [2012-11-27 05:09 UTC]
-Status: Open +Status: Wont fix
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Sep 23 13:01:24 2023 UTC