From:             nightstorm at tlen dot pl
Operating system: Windows XP
PHP version:      5.1.2
PHP Bug Type:     Scripting Engine problem
Bug description:  Destructor, include/require and path with "./"

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 bug report at http://bugs.php.net/?id=36454&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36454&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36454&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36454&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36454&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36454&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36454&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36454&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36454&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36454&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36454&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36454&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36454&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36454&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36454&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36454&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36454&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36454&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36454&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36454&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36454&r=mysqlcfg

Reply via email to