php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2386 $PHP_SELF doesn't handle $PATH_INFO correctly
Submitted: 1999-09-27 02:39 UTC Modified: 2002-06-16 08:58 UTC
From: phpbugs at reuben dot com Assigned:
Status: Not a bug Package: Misbehaving function
PHP Version: 3.0.12 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: phpbugs at reuben dot com
New email:
PHP Version: OS:

 

 [1999-09-27 02:39 UTC] phpbugs at reuben dot com
$PHP_SELF should always contain the location of the script itself, correct?  Because if I use a url like this:

 /script.php3/more/path/info

then $PHP_SELF contains:

 /script.php3/more/path/info

when it *seems* like it should only be:

 /script.php3

as the extra path info is being sent *to* the script (as the variable $PATH_INFO) and has nothing to do with where the script is.  If you want to build the full URL again you could use "$PHP_SELF . $PATH_INFO".

Does that make sense?  I couldn't find an official reference for what $PHP_SELF is *supposed* to describe, but it seems like it should just be the script.

- Isaac

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-22 17:05 UTC] andy@php.net
I have confirmed that PHP does this (even in 4.0.6), but I
don't know if it should be considered a bug or if it should
be changed.
 [2002-06-16 08:58 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-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 10:01:30 2025 UTC