#36454 [Opn]: Destructor, include/require and path with "./"

From: Date: Mon, 10 Apr 2006 12:55:50 +0000
Subject: #36454 [Opn]: Destructor, include/require and path with "./"
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969372647@lists.php.net to get a copy of this message
ID: 36454 Updated by: sniper@php.net Reported By: nightstorm at tlen dot pl Status: Open -Bug Type: Scripting Engine problem +Bug Type: Documentation problem Operating System: Windows XP PHP Version: 5.1.2 New Comment: It's because of Apache which changes the current working dir at some point(s). Not PHP bug to be fixed. Previous Comments: ------------------------------------------------------------------------ [2006-02-19 20:05:35] nightstorm at tlen dot pl Description: ------------ In the reproduce code we include a file "test.php" showing 'Hello World' six times: - Outside a destructor: "test.php" - Outside a destructor: "D:\server\www\test\test.php" (full path) - Outside a destructor: "./test.php" These three cases work. We don't change include path and try them in a destructor: - Outside a destructor: "test.php" - works - Outside a destructor: "D:\server\www\test\test.php" (full path) - works - Outside a destructor: "./test.php" - No such file or directory, even if the file exists. Outside a destructor, PHP parses correctly the include path, inside it seems to be broken, because a fatal error is generated. PHP manual doesn't explain why the last case doesn't work, I also can't find any reason. I hope you'll fix it quickly. ---Configuration--- Windows XP SP 2 (NTFS) PHP 5.1.2 Apache 2.0.55 Ze1.compatibility = 0 Include path = .;C:\php5\pear (PHP 5 default) Safe mode = off Reproduce code: --------------- test.php: <?php echo 'Hello world!<br/>'; ?> problem.php: <?php require('test.php'); require('D:\server\www\test\test.php'); require('./test.php'); class foo{ function __destruct() { require('test.php'); require('D:\server\www\test\test.php'); require('./test.php'); } } $foo = new foo; ?> Expected result: ---------------- Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Actual result: -------------- Hello world! Hello world! Hello world! Hello world! Hello world! Warning: foo::require(./test.php) [function.require]: failed to open stream: No such file or directory in D:\server\www\test\problem.php on line 11 Fatal error: foo::require() [function.require]: Failed opening required './test.php' (include_path='.;C:\php5\pear') in D:\server\www\test\problem.php on line 11 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36454&edit=1

« previous php.doc (#969372647) next »