Opened 19 years ago
Closed 19 years ago
#4971 closed defect (bug) (invalid)
use of PATH_TRANSLATED in wp-settings.php
| Reported by: | aronbeal | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | 2.2.2 |
| Severity: | normal | Keywords: | PATH_TRANSLATED, wp-settings.php |
| Cc: | Focuses: |
Description
In the latest SVN tagged revision (2.2.2) (and earlier, I believe), the wp-settings.php file makes use of the $_SERVER variable PATH_TRANSLATED. This variable seems to have been deprecated, as stated on the php.ini core directives page.
This is similar to a prior issue for a different file, posted in the trac awhile back.
This arises around line 40 in wp-settings.php on the copy I have; it should not have been modified since I checked it out from svn. It appears also in the latest subversion trunk revision (6110).
The particular usage is to assign its value to the server value for SCRIPT_FILENAME, even though php recommends explicitly using SCRIPT_FILENAME instead of PATH_TRANSLATED.
Relevant code in wp-settings.php (starting at line 38, [whitespace modified]):
// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something
// ending in php.cgi for all requests
if ( isset($_SERVER['SCRIPT_FILENAME']) &&
( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') ==
strlen($_SERVER['SCRIPT_FILENAME']) - 7 )
)
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
PATH_TRANSLATEDis only used ifSCRIPT_FILENAMEends in 'php.cgi' as it does in some screwy PHP installs (I think Dreamhost is the big one). So we're only usingPATH_TRANSLATEDin a case whereSCRIPT_FILENAMEis useless to us.A normal PHP installation will never see this code.
Do you have evidence that this fix is not working for some hosts that end
SCRIPT_FILENAMEin 'php.cgi' ? If so, reopen.