- only addref if we remember the stream
authorMichael Wallner <mike@php.net>
Tue, 6 Sep 2005 12:01:42 +0000 (12:01 +0000)
committerMichael Wallner <mike@php.net>
Tue, 6 Sep 2005 12:01:42 +0000 (12:01 +0000)
http_response_object.c

index 423b7b7054f8081c4c661146790093917e455faf..4f31e3158fd050871e93b89df2c09eb7c9318d59 100644 (file)
@@ -707,9 +707,8 @@ PHP_METHOD(HttpResponse, setStream)
        if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &the_stream)) {
                RETURN_FALSE;
        }
-       zend_list_addref(Z_LVAL_P(the_stream));
-       php_stream_from_zval(the_real_stream, &the_stream);
        
+       php_stream_from_zval(the_real_stream, &the_stream);
        if (php_stream_stat(the_real_stream, &ssb)) {
                RETURN_FALSE;
        }
@@ -718,7 +717,8 @@ PHP_METHOD(HttpResponse, setStream)
                        (SUCCESS != UPD_STATIC_PROP(long, mode, SEND_RSRC))) {
                RETURN_FALSE;
        }
-
+       zend_list_addref(Z_LVAL_P(the_stream));
+       
        if (!(Z_LVAL_P(GET_STATIC_PROP(lastModified)) > 0)) {
                UPD_STATIC_PROP(long, lastModified, http_last_modified(the_real_stream, SEND_RSRC));
        }