php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1623 Inconsistent/incorrect PATH_TRANSLATED
Submitted: 1999-06-29 06:44 UTC Modified: 2002-06-16 08:32 UTC
From: greg at elysium dot ltd dot uk Assigned:
Status: Not a bug Package: Misbehaving function
PHP Version: 3.0.9 OS: Linux 2.0.35
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:
45 - 25 = ?
Subscribe to this entry?

 
 [1999-06-29 06:44 UTC] greg at elysium dot ltd dot uk
(Under Apache 1.3.6.)

There is a contradiction between the value PHP returns for PATH_TRANSLATED and the value displayed by phpinfo, e.g. in the following script (foo.php3):

  print "$PATH_INFO<BR>\n";
  print "$PATH_TRANSLATED<BR>\n";
  phpinfo();

I first noticed the problem when trying to get a script to act as a handler for files in a subdirectory (using a .htaccess file with AddHandler and Action directives), but the problem is more general.

PATH_INFO always seems to agree with phpinfo, and PATH_TRANSLATED always seems to be the full pathname of the actual PHP script, regardless of what phpinfo says.

For example, fetching "http://www/~greg/foo.php3" complains only that PATH_INFO is uninitialised, and says PATH_TRANSLATED=/home/greg/public_html/foo.php3, whereas phpinfo does not display either PATH_INFO or PATH_TRANSLATED in this case. Fetching "http://www/~greg/foo.php3/bar" agrees with phpinfo that PATH_INFO=/bar, but says PATH_TRANSLATED=/home/greg/public_html/foo.php3 (same as the first example), whereas phpinfo says PATH_TRANSLATED=/var/lib/htdocs/bar (definitely wrong).

This could be an Apache bug as well/instead, but phpinfo needs correcting if the Apache version of the variable is actually inaccessible to PHP...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-29 07:31 UTC] greg at elysium dot ltd dot uk
Actually in the case of using PHP as a handler, the phpinfo version of PATH_TRANSLATED is the correct one, and since this is the only way of knowing the true path to the file the behaviour explained above makes it impossible to work this out. So, unless I've got something wrong, the PHP version definitely needs to be changed.
 [2002-06-16 08:32 UTC] sander@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately, PHP 3 is no longer supported. Please download
the latest version of PHP 4 from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 20:01:45 2024 UTC