#32744 [Opn]: possible twice including by require_once() after chdir()

From: Date: Mon, 18 Apr 2005 14:31:59 +0000
Subject: #32744 [Opn]: possible twice including by require_once() after chdir()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-77797@lists.php.net to get a copy of this message
ID: 32744 User updated by: vovik at getart dot ru Reported By: vovik at getart dot ru Status: Open Bug Type: Filesystem function related Operating System: Windows XP PHP Version: 4.3.11 New Comment: 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()); Previous Comments: ------------------------------------------------------------------------ [2005-04-18 16:29:23] 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 :) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32744&edit=1

« previous php.bugs (#77797) next »