[PHP-DOC] #36454 [Opn]: Destructor, include/require and path with "./"
by sniper other posts by this author
Apr 10 2006 5:56AM messages near this date
[PHP-DOC] #37027 [Opn->Bgs]: mkdir($dir, 0777, true) does NOT chmod created directory
|
[PHP-DOC] #37028 [NEW]: odbc_execute docs say single quotes can be quoted; this is not possible
ID: 36454
Updated by: sniper@[...].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
|