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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
44 - 13 = ?
Subscribe to this entry?

 
 [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-2019 The PHP Group
All rights reserved.
Last updated: Tue Oct 22 16:01:28 2019 UTC