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

From: Date: Mon, 22 Jan 2007 23:12:24 +0000
Subject: #36454 [Opn->Bgs]: Destructor, include/require and path with "./"
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969374995@lists.php.net to get a copy of this message
ID: 36454 Updated by: didou@php.net Reported By: nightstorm at tlen dot pl -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: Windows XP PHP Version: 5.1.2 New Comment: 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. Dup of #34206 Previous Comments: ------------------------------------------------------------------------ [2006-04-10 12:55:49] sniper@php.net It's because of Apache which changes the current working dir at some point(s). Not PHP bug to be fixed. ------------------------------------------------------------------------ [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 (#969374995) next »