Merge branch 'R_2_1'
authorMichael Wallner <mike@php.net>
Thu, 6 Nov 2014 15:23:38 +0000 (16:23 +0100)
committerMichael Wallner <mike@php.net>
Thu, 6 Nov 2014 15:23:38 +0000 (16:23 +0100)
php_http_env_response.c
tests/bug66891.phpt [new file with mode: 0644]

index c155dde3263bde5cba07c77ec108a4f7abd80077..13a35c6af7054803de8760f6cc688ee2745ab954 100644 (file)
@@ -329,6 +329,17 @@ static STATUS php_http_env_response_send_head(php_http_env_response_t *r, php_ht
                return ret;
        }
 
+       if ((zoption = get_option(options, ZEND_STRL("headers") TSRMLS_CC))) {
+               if (Z_TYPE_P(zoption) == IS_ARRAY) {
+                       php_http_header_to_callback(Z_ARRVAL_P(zoption), 0, (php_http_pass_format_callback_t) r->ops->set_header, r TSRMLS_CC);
+               }
+               zval_ptr_dtor(&zoption);
+       }
+
+       if (ret != SUCCESS) {
+               return ret;
+       }
+
        if ((zoption = get_option(options, ZEND_STRL("responseCode") TSRMLS_CC))) {
                zval *zoption_copy = php_http_ztyp(IS_LONG, zoption);
 
@@ -359,17 +370,6 @@ static STATUS php_http_env_response_send_head(php_http_env_response_t *r, php_ht
                return ret;
        }
 
-       if ((zoption = get_option(options, ZEND_STRL("headers") TSRMLS_CC))) {
-               if (Z_TYPE_P(zoption) == IS_ARRAY) {
-                       php_http_header_to_callback(Z_ARRVAL_P(zoption), 0, (php_http_pass_format_callback_t) r->ops->set_header, r TSRMLS_CC);
-               }
-               zval_ptr_dtor(&zoption);
-       }
-
-       if (ret != SUCCESS) {
-               return ret;
-       }
-
        if ((zoption = get_option(options, ZEND_STRL("contentType") TSRMLS_CC))) {
                zval *zoption_copy = php_http_ztyp(IS_STRING, zoption);
 
diff --git a/tests/bug66891.phpt b/tests/bug66891.phpt
new file mode 100644 (file)
index 0000000..0fd84f8
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Bug #66891 (Unexpected HTTP 401 after NTLM authentication)
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--GET--
+dummy=1
+--FILE--
+<?php
+header("WWW-Authenticate: none");
+$r = new http\Env\Response;
+$r->setResponseCode(200);
+$r->send();
+var_dump(http_response_code());
+?>
+--EXPECT--
+int(200)
\ No newline at end of file