#16409 [Opn->Bgs]: include_once includes multiple times

From: Date: Thu, 22 Aug 2002 16:32:33 +0000
Subject: #16409 [Opn->Bgs]: include_once includes multiple times
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-17570@lists.php.net to get a copy of this message
ID: 16409 Updated by: iliaa@php.net Reported By: michael@janneck.de -Status: Open +Status: Bogus Bug Type: Filesystem function related Operating System: Mac OS X 10.1.3 PHP Version: 4.1.2 New Comment: Thank you for taking the time to report a problem with PHP. Unfortunately you are not using a current version of PHP -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PHP. Previous Comments: ------------------------------------------------------------------------ [2002-05-17 05:24:49] preston.bannister@cox.net I'd suggest that if include_once() is given two distinct paths that just happen to work out the to same file, asking PHP to figure out that these are the same file is too much trouble. There are too many tricky cases (like the permissions case documented here) that are difficult or impossible to get right. On Win32 you could have UNC and local names pointing to the same file. On Unix you could hard and soft links pointing to the same file. Sounds like a lot of trouble :). Probably the safest bet is to document include_once() and require_once() as determining file identity strictly by name. ------------------------------------------------------------------------ [2002-04-09 07:12:25] michael@janneck.de I installed the update and it still did not work for me. I then looked where there might be a problem with my installation and finally found, that the problem occurs, if the webserver does not have read access to all directories on the path to the script file. I had my home dir set to rwx--x--x for privacy reasons. Giving read-access for the world, solved the problem. I don't know if there is a way to solve this problem, but it is definitely not nice, that the functions do not work correctly depending on access rights. ------------------------------------------------------------------------ [2002-04-06 12:31:08] markonen@php.net I cannot reproduce this on either the Apple-supplied PHP 4.1.2 or a fresh 4.3.0-dev build, running on the default Apache installation (1.3.22). realpath() also works as expected. Can you install Apple's new Security Update, which includes PHP 4.1.2? If it works for you, we can start narrowing down why it doesn't work on your custom PHP build. ------------------------------------------------------------------------ [2002-04-03 06:13:57] michael@janneck.de There is a bug with include_once including a file twice, if it is referenced once with a fully qualified path and once with only the filename (and the file being in the include path). This script illustrates what I mean: include_once('x.php'); include_once('/home/janneck/public_html/x.php'); On my Mac OS X 10.1.3, Apache 1.3.22, PHP 4.1.2 (also: 4.0.6) system, this results in x.php getting included twice. (It works as expected on RedHat 7.1, Apache 1.3.22, PHP 4.0.6.) doing "var_dump(get_included_files());" shows the following: array(2) { [0]=> string(6) "/x.php" [1]=> string(40) "/home/janneck/public_html/x.php" } This might be related to a problem with the "realpath()" function which does not work correctly but returns "" all the time. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=16409&edit=1

« previous php.bugs (#17570) next »