#34514 [Fbk]: __FILE__ gives relative path if not in web root

From: Date: Thu, 15 Sep 2005 15:06:43 +0000
Subject: #34514 [Fbk]: __FILE__ gives relative path if not in web root
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-85105@lists.php.net to get a copy of this message
 ID:               34514
 Updated by:       sniper@php.net
 Reported By:      madison at westga dot edu
 Status:           Feedback
 Bug Type:         Scripting Engine problem
 Operating System: Solaris 8
 PHP Version:      4.4.0
 New Comment:

And check also if this happens when using CLI..



Previous Comments:
------------------------------------------------------------------------

[2005-09-15 17:01:12] sniper@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip



------------------------------------------------------------------------

[2005-09-15 16:58:18] 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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34514&edit=1


Thread (6 messages)

« previous php.bugs (#85105) next »