Make WordPress Core

Opened 19 years ago

Closed 18 years ago

Last modified 17 years ago

#1591 closed defect (bug) (fixed)

The difference in $_SERVER['PATH_INFO']

Reported by: gslin's profile gslin Owned by: markjaquith's profile markjaquith
Milestone: Priority: normal
Severity: normal Version: 1.6
Component: General Keywords: cgi bg|has-patch bg|squashed bg|commit
Focuses: Cc:

Description

I run WordPress 1.6-ALPHA2-still-dont-use in DreamHost, it's default PHP setting is CGI mode (php-cgi) and I perfer this mode for security reason.

If I enable permlinks with "Custom structure" and then WordPress will write the following rules in .htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>
# END WordPress

In mod_php mode $_SERVERPATH_INFO? will be NULL, and in php-cgi mode it will be '/index.php' (by .htaccess).

The attachment patches classes.php to check if $pathinfo is index.php.

Attachments (2)

classes-php.diff (450 bytes) - added by gslin 19 years ago.
wp-settings.php.diff (746 bytes) - added by markjaquith 18 years ago.
Patch for WP 1.6 SVN

Download all attachments as: .zip

Change History (12)

@gslin
19 years ago

#1 @gslin
19 years ago

  • Keywords cgi added
  • Owner changed from anonymous to matt

#2 @markjaquith
19 years ago

  • Keywords bg|has-patch added

#3 @ryan
19 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [2852]) If PATH_INFO contains the index, don't use it for permalinks. Props gslin. fixes #1591

#4 @markjaquith
18 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This is still the problem. this was my solution:

if ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 )
	$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
if ( $_SERVER['PATH_INFO'] == $_SERVER['PHP_SELF'] )
	unset($_SERVER['PATH_INFO']);

Fixes two problems with PHP as CGI on Dreamhost.

@markjaquith
18 years ago

Patch for WP 1.6 SVN

#5 @markjaquith
18 years ago

Make that "This is still a problem"

#6 @markjaquith
18 years ago

  • Keywords bg|squashed bg|commit added

#7 @markjaquith
18 years ago

  • Milestone set to 1.6
  • Owner changed from matt to markjaquith
  • Status changed from reopened to new

#8 @markjaquith
18 years ago

  • Status changed from new to assigned

#9 @matt
18 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [3034]) Fixes #1591 (again)

#10 @(none)
17 years ago

  • Milestone 2.0 deleted

Milestone 2.0 deleted

Note: See TracTickets for help on using tickets.