php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7085 PHP_SELF returns incorrect value
Submitted: 2000-10-08 09:11 UTC Modified: 2000-10-10 08:49 UTC
From: martijnklingens at netscape dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.2 OS: Linux 2.2.13 / Apache 1.3.9
Private report: No CVE-ID: None
 [2000-10-08 09:11 UTC] martijnklingens at netscape dot net
When including files with require() or require_once(), any functions defined within these files do not have the correct value set for $PHP_SELF

The problem occurs with functions and class methods in require'd files, but not in the main body of those files.

a simple file to reproduce the crash:

<file.inc>
<?PHP
function ShowError () {
  echo $PHP_SELF;
}
?>

<file.php>
<?PHP
  require ("file.inc");
  ShowError ();
?>

If you need any additional information, feel free to contact me. Thanks in advance for your help.

-- Martijn Klingens

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-10 08:49 UTC] stas@php.net
use $GLOBALS["PHP_SELF"] or add global $PHP_SELF before the echo statement.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jul 15 16:00:01 2026 UTC