Re: Patch for HTTP successful status codes
| From: | Hannes Magnusson | Date: | Fri, 25 Jul 2008 10:53:36 +0000 |
| Subject: | Re: Patch for HTTP successful status codes | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39321@lists.php.net to get a copy of this message | ||
On Wed, Jul 23, 2008 at 19:40, Noah Fontes <noah.fontes@bitextender.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> David Zülke wrote:
>> Yeah. We discussed that quite a while back when I sent over the
>> "ignore_errors" options patch-like thing in November:
>> http://thread.gmane.org/gmane.comp.php.devel/46003
>>
>> I think we should do it.
>>
>> But what about other 3xx redirect codes? How are those handled?
>
> I think PHP implicitly follows any Location headers it can. That's
> probably not the right behavior, but for an automated process it's not bad.
>
> I think that 3xx status codes, if they appear without a Location header,
> should also probably not throw errors. They could provide valuable
> information about the status of a page (particularly 304 Not Modified),
> so I've updated the patch:
>
> http://cynigram.com/~nfontes/http_fopen_wrapper.patch
>
> BTW, any chance this could be rolled into 5.3? I think the BC break is
> pretty non-notable, and it would be nice to stop throwing errors for
> successful responses.
I think changing all 3xx status codes to be success is a slightly more
bc break then you think.
A simple example:
I do a file_get_contents() request. Store it in a local buffer.
I do a second file_get_contents(), get a error (304) back, print out my buffer.
Now, in 5.3.0 the 304 is treated as success so I naturally discard my
buffer and print the results of the new request... Whooopsy, there was
no data :(
-Hannes