]> granicus.if.org Git - php/commitdiff
Fixed bug #38802 (max_redirects and ignore_errors)
authorArnaud Le Blanc <lbarnaud@php.net>
Sat, 16 May 2009 20:34:48 +0000 (20:34 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Sat, 16 May 2009 20:34:48 +0000 (20:34 +0000)
(patch by datibbaw@php.net)

NEWS
ext/standard/http_fopen_wrapper.c

diff --git a/NEWS b/NEWS
index 5d75c2e29a27e52a298868b33d59e286ba45e063..e9e04f1b047290abcd4e0b1b1532a38b7d2b4d43 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,8 @@ PHP                                                                        NEWS
   --enable-zend-multibyte is used). (Jani)
 - Fixed bug #48188 (Cannot execute a scrollable cursors twice with
   PDO_PGSQL). (Matteo)
+- Fixed bug #38802 (max_redirects and ignore_errors).
+  (patch by datibbaw@php.net)
 
 
 07 May 2009, PHP 5.3.0 RC 2
index 948d736b48df12f0474d9f437d1318067d9c7a37..e31e99bee9b59a8917b00f3ba029378d070117d2 100644 (file)
@@ -104,7 +104,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
        size_t chunk_size = 0, file_size = 0;
        int eol_detect = 0;
        char *transport_string, *errstr = NULL;
-       int transport_len, have_header = 0, request_fulluri = 0;
+       int transport_len, have_header = 0, request_fulluri = 0, ignore_errors = 0;
        char *protocol_version = NULL;
        int protocol_version_len = 3; /* Default: "1.0" */
        struct timeval timeout;
@@ -557,9 +557,11 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
                        } else {
                                response_code = 0;
                        }
+                       if (context && SUCCESS==php_stream_context_get_option(context, "http", "ignore_errors", &tmpzval)) {
+                               ignore_errors = zend_is_true(*tmpzval);
+                       }
                        /* when we request only the header, don't fail even on error codes */
-                       if ((options & STREAM_ONLY_GET_HEADERS) ||
-                               (context && php_stream_context_get_option(context, "http", "ignore_errors",  &tmpzval) == SUCCESS && zend_is_true(*tmpzval)) ) {
+                       if ((options & STREAM_ONLY_GET_HEADERS) || ignore_errors) {
                                reqok = 1;
                        }
                        /* all status codes in the 2xx range are defined by the specification as successful;
@@ -656,7 +658,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
        }
        
        if (!reqok || location[0] != '\0') {
-               if (options & STREAM_ONLY_GET_HEADERS && redirect_max <= 1) {
+               if (((options & STREAM_ONLY_GET_HEADERS) || ignore_errors) && redirect_max <= 1) {
                        goto out;
                }