Opened 6 years ago

Closed 4 years ago

#4918 closed enhancement (wontfix)

Simpler resolution to ticket 3215, wp_redirect status code on fastcgi

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

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 6 years ago.
Patch
wp_redirect.v2.diff (756 bytes) - added by chmac 6 years ago.
Patch v2 - dependent on PHP version >= 4.3.0

Download all attachments as: .zip

Change History (10)

chmac6 years ago

Patch

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

comment:2   DD326 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?

  • Cc chmac added

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

chmac6 years ago

Patch v2 - dependent on PHP version >= 4.3.0

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.

  • Milestone changed from 2.5 to 2.6
  • Keywords has-patch needs-testing early added; wp_redirect removed
  • Keywords commit added; early removed

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

comment:8   ryan4 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.