Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#4971 closed defect (bug) (invalid)

use of PATH_TRANSLATED in wp-settings.php

Reported by: aronbeal Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.2.2
Component: General Keywords: PATH_TRANSLATED, wp-settings.php
Focuses: Cc:


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 ) 

Change History (2)

#1 @foolswisdom
11 years ago

  • Milestone changed from 2.2.3 to 2.3

#2 @markjaquith
11 years ago

  • Milestone 2.3 deleted
  • Resolution set to invalid
  • Status changed from new to closed

PATH_TRANSLATED is only used if SCRIPT_FILENAME ends in 'php.cgi' as it does in some screwy PHP installs (I think Dreamhost is the big one). So we're only using PATH_TRANSLATED in a case where SCRIPT_FILENAME is 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_FILENAME in 'php.cgi' ? If so, reopen.

Note: See TracTickets for help on using tickets.