php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24886 PATH_TRANSLATED is wrong
Submitted: 2003-07-31 11:05 UTC Modified: 2003-07-31 18:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: lenar at city dot ee Assigned: iliaa (profile)
Status: Closed Package: Apache related
PHP Version: 4.3.3RC2 OS: debian/unstable
Private report: No CVE-ID: None
 [2003-07-31 11:05 UTC] lenar at city dot ee
Description:
------------
in apache configuration where many virtual hosts are in 
use, PATH_TRANSLATED doesn't always get set to correct 
path. 
 
Instead the value seems to reflect some other (older) 
request. Possibly the value is correct only if brand new 
apache child serves the request. 
 
The value in $_SERVER array is always correct. 
 
Current workaround: add extract($_SERVER, EXTR_OVERWRITE); 
to your auto-prepend php file. 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-31 13:23 UTC] sniper@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2003-07-31 16:12 UTC] lenar at city dot ee
Really it's hard to explain this. 
One thing is for sure: 
echo $_SERVER['PATH_TRANSLATED'] and echo $PATH_TRANSLATED 
give different outputs. 
 
register_globals is _on_. 
 
Actually after studying it seems that $PATH_TRANSLATED 
gets the same value that is in $_ENV['PATH_TRANSLATED'] 
which in turn seems to be DOCUMENT_ROOT but sometimes it 
is not the correct DOCUMENT_ROOT but document root of some 
other virtual host. 
 
But anyway it should be easily testable to some degree 
with this code: 
<? echo $PATH_TRANSLATED . "\n"; echo 
$_SERVER['PATH_TRANSLATED']; ?> 
 
I get: 
/var/www/ 
/home/user/public_html/index.php 
 
My variables_order = "EGPCS" 
 
So I would expect the value in $_SERVER to be accessible 
by $PATH_TRANSLATED not the one in $_ENV. 
 
Why the value in $_ENV sometimes contains the path of some 
other virtul host's document root is still beyond me. 
 
Apache is 1.3.27
 [2003-07-31 16:21 UTC] iliaa@php.net
Note to self, maybe related to bug #24883.
 [2003-07-31 18:00 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Jun 25 19:05:44 2022 UTC