WordPress.org

Make WordPress Core

Opened 14 years ago

Closed 12 years ago

#4918 closed enhancement (wontfix)

Simpler resolution to ticket 3215, wp_redirect status code on fastcgi

Reported by: chmac Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch needs-testing commit
Focuses: Cc:

Description

The resolution to ticket #3215 was at source:/trunk/wp-includes/pluggable.php@latest#L420

The code is:
if ( php_sapi_name() != 'cgi-fcgi' )

status_header($status); This causes problems on IIS and some FastCGI setups

header("Location: $location");

This is simpler and works on both mod_php and fast cgi:
header("Location: $location",null,$status);

Any reason why not to use this approach? I've attached a patch.

Attachments (2)

wp_redirect.diff (518 bytes) - added by chmac 14 years ago.
Patch
wp_redirect.v2.diff (756 bytes) - added by chmac 14 years ago.
Patch v2 - dependent on PHP version >= 4.3.0

Download all attachments as: .zip

Change History (10)

@chmac
14 years ago

Patch

#1 @chmac
14 years ago

Also, this approach actually sends the redirect code on fast cgi, the current code does not, it defaults to a 302 redirect.

#2 @DD32
14 years ago

the 2nd and 3rd parameters are only available for PHP >= 4.3.0, WP's baseline is 4.2

Heres the definition for the status_header() function:
http://trac.wordpress.org/browser/trunk/wp-includes/functions.php#L746

As you see, it checks the version and calls appropriately.

Maybe a similar code structure can be used there as well?

#3 @chmac
14 years ago

  • Cc chmac added

Good point, I hadn't checked that. How about this latest patch instead then?

@chmac
14 years ago

Patch v2 - dependent on PHP version >= 4.3.0

#4 @markjaquith
14 years ago

No way we're touching this so close to release. We can explore this for 2.4, but our experience with this stuff is that when you change anything, you break it for a whole bunch of people.

#5 @ffemtcj
14 years ago

  • Milestone changed from 2.5 to 2.6

#6 @Denis-de-Bernardy
13 years ago

  • Keywords has-patch needs-testing early added; wp_redirect removed

#7 @Denis-de-Bernardy
12 years ago

  • Keywords commit added; early removed

we're now requiring php 4.3. commit or wontfix?

#8 @ryan
12 years ago

  • Milestone 2.9 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

This would have us always skipping our status_header() function. We should put whatever logic we need in that function.

Note: See TracTickets for help on using tickets.