php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6385 __FILE__ returns lowercased filenames
Submitted: 2000-08-27 21:28 UTC Modified: 2001-05-28 00:29 UTC
From: waldschrott@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Latest CVS (27/08/2000) OS: w32
Private report: No CVE-ID: None
 [2000-08-27 21:28 UTC] waldschrott@php.net
if I?m calling a file "FooBar.php", echo __FILE__; will
output "foobar.php".
Although w32 allows files only in-sensitive (no FooBar.php
and foobar.php concurrently) it saves the case information
and thus __FILE__ (and related) should contain this cased
information too.
This will bug will also cause scripts not to be platform
independend:

// filename  lowercased
$filename=basename(__FILE__);
// HTTP REQUEST, w cased filename
$fullpage=substr($tmp=strtolower(getenv('SERVER_PROTOCOL')),0,strpos($tmp,'/')).'://'.getenv('HTTP_HOST').getenv('REQUEST_URI');
	
$pageonly=substr($fullpage,0,strpos($fullpage,$filename)+strlen($filename));

hile this script should work on *nix calling "foobar.php" it
does not on w32

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-31 09:02 UTC] stas@php.net
Does this happen with CGI version? I suspect it might be just IIS which sets your filename lowercase...
 [2000-11-04 06:34 UTC] waldschrott@php.net
tested on CGI+ApacheMod, both return lowercased
 [2001-01-08 15:40 UTC] cynic@php.net
not IIS-specific, reclassifying
 [2001-05-06 15:12 UTC] zeev@php.net
Does this still happen with 4.0.5 or latest CVS?  I can't reproduce it.
 [2001-05-28 00:29 UTC] sniper@php.net
No feedback, closed (can't reproduce either)

 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Mar 02 11:01:23 2021 UTC