php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25381 include_once failed to recognize identical file
Submitted: 2003-09-03 10:00 UTC Modified: 2003-09-08 22:00 UTC
From: ulysses at mail dot fitan dot com dot tw Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.3 OS: Windows 2K, IIS5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ulysses at mail dot fitan dot com dot tw
New email:
PHP Version: OS:

 

 [2003-09-03 10:00 UTC] ulysses at mail dot fitan dot com dot tw
Description:
------------
In PHP 4.3.3 include_once() is case-sensitive. This will 
cause some problem on case-insensitive filesystems, such as 
Windows. Please see the reproduce code.

Of course I will never use this teenager-hacker-style 
strings for actual coding, but it means trouble when mixed 
using relative and absolute path within codes. I spent 
hours debugging, only to found it's the "I"netpub directory 
(IIS default setting) name problem.

Yes, this problem can be work-around. But if include_once() 
feels that 'C:/Inetpub/wwwroot/b.php' and 'c:/inetpub/
wwwroot/b.php' are different, please do not let me include 
it, or please give me some warning.

This had never happened in PHP 4.3.2 or previous version.

Reproduce code:
---------------
I've got two files: a.php & b.php, which are put in the same directory. The actual absolute to b.php is 'C:/Inetpub/wwwroot/b.php';

a.php:
<?
$mydir = 'c:/inEtpUB/wwwRoOT';
echo "<P>THIS IS A.PHP";
include_once("b.php");
include_once("$mydir/b.php");
?>

b.php
<?
echo "<P>THIS IS B.PHP";
?>


Expected result:
----------------
THIS IS A.PHP
THIS IS B.PHP

Actual result:
--------------
THIS IS A.PHP
THIS IS B.PHP
THIS IS B.PHP

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-08 22:00 UTC] ulysses at mail dot fitan dot com dot tw
> RTFM: http://www.php.net/include_once

Do you mean this ?

> Note: Be aware, that the behaviour of include_once()
> and require_once() may not be what you expect on a 
> non case sensitive operating system (such as Windows). 

How convenient!
Then please tell me, WHAT CAN I EXPECT ?
My code runs well on 4.30, and crashed when my client 
upgrade their system to 4.33, can I tell me client to RTFM 
?

I just demand for a notice message, or do you want Windows 
developers to build a included_file_array by their self in 
all code ?

No wonder why there are so few enterprises who would adopt 
PHP for critical task. Cause it can not be EXPECTED!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 21 10:00:02 2025 UTC