[wp-testers] Can we delete this code from classes.php?

Kirk Steffensen blogger at steffensenfamily.com
Wed Feb 1 23:31:13 GMT 2006


Quoting Andy Skelton <skeltoac at gmail.com>:

> I think this statement is too broad. If you need part of wp() but not
> the rest, you can call the needed functions individually. Still, this
> isn't optimal.

Ryan had a good suggestion on this that I'll try tonight.  At the risk of
beating a dead horse, even if we fix the current WPG2 problem, I think 
WP is at
risk of breaking other apps/plugins because of the 200 HTTP code.

> I still think this isn't the right target. A call to header('Location:
> <url>') should set the status code to 302 unless it was set by a
> previous header() call, in which case an additional header() call is
> required to specify the 302 status code. So either Gallery is setting
> the Location header and neglecting to set the status code, or Gallery
> is setting both and PHP is screwing up on your setup.
>
> Do you want to trace the code through Gallery to find where the
> Location header is being set?

It's not being set by Gallery in all cases.  For example, try going to

http://www.steffensenfamily.com/wordpress/wp-gallery2.php?g2_controller=exif.SwitchDetailMode&g2_mode=summary&g2_return=http%3A%2F%2Fwww.steffensenfamily.com%2Fwordpress%2Fv%2F2004_12_Christmas%2F2004_Steffensen_Christmas_Web_Version.jpg.html&g2_returnName=photo

and you'll get the error.  That's just a straight link without a POST or GET,
which should be redirected by the mod rewrite rules to

http://www.steffensenfamily.com/gallery2/main.php?g2_controller=exif.SwitchDetailMode&g2_mode=summary&g2_return=http%3A%2F%2Fwww.steffensenfamily.com%2Fwordpress%2Fv%2F2004_12_Christmas%2F2004_Steffensen_Christmas_Web_Version.jpg.html&g2_returnName=photo

but handle_404() is returning the 200 status code and choking Apache.  If the
elseif is commented out, it works perfectly.

(NOTE: After going to the Gallery2 page above, when it's working right, 
it comes
back with
http://www.steffensenfamily.com/wordpress/v/2004_12_Christmas/2004_Steffensen_Christmas_Web_Version.jpg.html?g2_fromNavId=xbbe53320
without the user ever seeing it.  This is the address that the "here" link in
the error page is pointing to.  You can test this out by going to the
/gallery2/ link above.)

Apache is setting the status code to 302 from looking at my logs. 
Unfortunately, since I'm on a shared hosting service (simplehost.com), 
I can't
change my mod rewrite logs to verbose to really see what is going on.  But I
can clearly see the 302 in the last message in the log when I get that 
error. But then handle_404() is overriding it before

I think leaving out the handle_404() like Ryan suggested will solve the 
problem.
I'll test it tonight and verify that.  But anyone else that has a rewrite link
like the one above to a page that calls wp() without leaving out handle_404()
will have the same problem, because after handle_404() gets to the end of it's
logic, it will assign a 200 overriding the correct 302.



More information about the wp-testers mailing list