Hi, On Fri, 2009-05-15 at 22:16 +0800, Tjerk Anne Meesters wrote: > Hi, > > I've been extending the pecl/oauth code to work with php stream > wrappers in cases whereby curl is not enabled, but I've hit a snag. > > The documentation states that enabling the "ignore_errors" flag will > fetch the content even on failure status codes. At the same time, > setting "max_redirects" to <= 1 indicates that no redirects will be > followed. > > It does not state that setting "max_redirects" <= 1 would actually > trigger an error, though in the code it returns (php_stream *)NULL > making it impossible to even get the headers out of the wrapperdata > hash unless STREAM_ONLY_GET_HEADERS is used. > > So, either setting "max_redirects" <= 1 should not throw NULL back > into the caller code or "ignore_error" behaviour should be extended to > prevent that from happening. > > My attached patch favours to fix the latter, since the "ignore_errors" > is a relatively new flag. Hope it will be accepted for the 5.3 > release.
max_redirects's purpose is to avoid infinite loops, etc. Stream functions are expected to return an error in case the limit is exceeded. If they do not, scripts will get an empty body without noticing the error (changing this may break existing scripts). ignore_errors is a new flag, it forces scripts to check HTTP status code (so that scripts will notice non-200 ones) and changing it to ignore redirects when max_redirects is exceeded seems to be a good solution. > > (not sure whether attachments will be allowed ... give me a ping if it > doesn't make it through) The list accepts only text/plain attachments (try renaming your patch to .txt). Regards, Arnaud -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php