php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32744 possible twice including by require_once() after chdir()
Submitted: 2005-04-18 16:29 UTC Modified: 2005-04-18 16:44 UTC
From: vovik at getart dot ru Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.11 OS: Windows XP
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: vovik at getart dot ru
New email:
PHP Version: OS:

 

 [2005-04-18 16:29 UTC] vovik at getart dot ru
Description:
------------
When script started and do require_once() by relative filename, this function remembers lower case real path.
If script changes working dir via chdir() and directory name consist of not lower-case letters, require_once() will include the file again.

Reproduce code:
---------------
<?php
// This file located under directory with non-lowercase name, i.e. "TesT"
print "<pre>";

require_once("./inc.php"); // single print line there

chdir("./..");
chdir("./TesT");

require_once("./inc.php");

var_dump(get_included_files());
?>

Expected result:
----------------
I expect to single include of inc.php.

Actual result:
--------------
Actually, got two :)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-18 16:31 UTC] vovik at getart dot ru
I've pasted the reproduce code with php tags and it was stripped. Here is it:

// This file located under directory with non-lowercase name, i.e. "TesT"
print "<pre>";

require_once("./inc.php"); // single print line there

chdir("./..");
chdir("./TesT");

require_once("./inc.php");

var_dump(get_included_files());
 [2005-04-18 16:44 UTC] derick@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

(And this is also expected)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC