php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38232 Relative Path Includes Broken
Submitted: 2006-07-27 09:31 UTC Modified: 2006-09-23 10:05 UTC
Votes:8
Avg. Score:5.0 ± 0.0
Reproduced:8 of 8 (100.0%)
Same Version:8 (100.0%)
Same OS:8 (100.0%)
From: serverprivacy at gmail dot com Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 5.2.0RC2-dev OS: Windows XP Pro SP2
Private report: No CVE-ID: None
 [2006-07-27 09:31 UTC] serverprivacy at gmail dot com
Description:
------------
Including a file using a relative path with a "." or "./" fails, giving a "No such file or directory" error.

OS: Windows XP Pro SP2
PHP: 5.2.0RC2-dev
Web: Apache 2.2.2

Reproduce code:
---------------
All files are in the same directory.

test1.php
<?php
include("message.php");
?>

test2.php
<?php
include("./message.php");
?>

message.php
<?php
echo "Success";
?>

Expected result:
----------------
test1 and test2 should both produce "Success".

Actual result:
--------------
test1 is fine.
test2 gives the following error message:

Warning: include(./message.php) [function.include]: failed to open stream: No such file or directory in C:\Apache\htdocs\test2.php on line 2

Warning: include() [function.include]: Failed opening './message.php' for inclusion (include_path='.;C:\Apache\PHP;C:\Apache\PHP\PEAR;C:\Apache\htdocs') in C:\Apache\htdocs\test2.php on line 2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-27 09:39 UTC] serverprivacy at gmail dot com
Updated version, drop down box didn't have it listed.
 [2006-09-22 08:29 UTC] bjori@php.net
You aren't running the apache2filter SAPI by any chance?
 [2006-09-22 23:54 UTC] serverprivacy at gmail dot com
I don't really know what that is, but according to my phpinfo(), yes I am using it. "Server API Apache 2.0 Filter"
 [2006-09-23 10:05 UTC] bjori@php.net
Dupe of bug#38904
(marking this as bogus as the other is already assigned)
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Dec 04 15:05:54 2022 UTC