php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34514 __FILE__ gives relative path if not in web root
Submitted: 2005-09-15 16:58 UTC Modified: 2005-09-27 19:05 UTC
From: madison at westga dot edu Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.4.0 OS: Solaris 9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: madison at westga dot edu
New email:
PHP Version: OS:

 

 [2005-09-15 16:58 UTC] madison at westga dot edu
Description:
------------
This bug: http://bugs.php.net/bug.php?id=13936 appears never to have been completely resolved.

Using the test code from the above bug...

If the code resides somewhere in the DocumentRoot then it works as expected. But, if it resides in a users public_html directory or inside an aliased directory, it doesn't give the correct path.

I get the same issue with the current CVS version of PHP5 and apache 2.

Reproduce code:
---------------
<?php
echo "original file is: " . __FILE__ . "<br>";
include("test2.php");
?>

contents of test2.php:
<?php
echo "included file is: " . __FILE__ . "<br>";

$boo = "another try:  " . __FILE__;
echo $boo;
?>

Expected result:
----------------
original file is: /home/madison/public_html/test.php
included file is: /home/madison/public_html/test2.php
another try: /home/madison/public_html/test2.php

Actual result:
--------------
original file is: /home/madison/public_html/test.php
included file is: ./test2.php
another try: ./test2.php

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-27 19:05 UTC] sniper@php.net
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.

See bug #34552 which is exactly same issue.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 14:01:31 2024 UTC