On Sat, Jul 26, 2008 at 22:37, David Zülke <[EMAIL PROTECTED]> wrote:
> Am 25.07.2008 um 12:53 schrieb Hannes Magnusson:
>
>> 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 :(
>
> The problem with the current behavior is that a warning is thrown, but the
> response is empty and there is no way to even tell the status code that you
> got back. Sure, there is the "ignore_errors" option in 5.3 that I proposed
> back in November (which Sara committed, thanks again), but still...

http://no.php.net/manual/en/reserved.variables.httpresponseheader.php ?
afaik this variable is always set, especially on errors.


> Also, to get back a 304, you'd have to send ETag and If-Modified-Since
> headers anyway, since it is only returned for such conditional requests - it
> won't happen in normal situations!

Why not? You try obviously set these headers to spare you needing to
fetch the content again if it hasn't changed.



> I'm relatively indifferent on this. For purposes where I need access to the
> info, I'll always set the "ignore_errors" option anyway. But if I had to
> choose, I'd say include 3xx codes in the "successful" group.

Like mike put it on IRC: "Ahh shit. You should be using pecl/http
anyway" describes the situation pretty well.
PHP only offers half baked implementation which is very useful for
regular joe, but as soon as you need to do anything fancy with it you
are shit out of luck.

I'm fine with just documenting this change in the "bc break" section,
but this is such a subtle change that will be very hard to debug
though :]

-Hannes

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to