fix arg by ref handling
authorMichael Wallner <mike@php.net>
Mon, 19 Jan 2015 10:52:40 +0000 (11:52 +0100)
committerMichael Wallner <mike@php.net>
Mon, 19 Jan 2015 10:52:40 +0000 (11:52 +0100)
php_http_encoding.c
php_http_env.c
php_http_header.c
php_http_message.c
php_http_message_parser.c
php_http_negotiate.c

index 30b4c81187acfced1f4bc5032009f92cbc73b2bd..ad08ff50298b87c992e39f1a087dbddf7f504ade 100644 (file)
@@ -1146,6 +1146,7 @@ static PHP_METHOD(HttpDechunkStream, decode)
 
                if ((end_ptr = php_http_encoding_dechunk(str, len, &enc_str, &enc_len))) {
                        if (zlen) {
+                               ZVAL_DEREF(zlen);
                                zval_dtor(zlen);
                                ZVAL_LONG(zlen, str + len - end_ptr);
                        }
index 239af9812a25141cfbfc1885f05150315d41b8bd..4c74966fb71eca4eea267c065ce5a51c614ab157 100644 (file)
@@ -813,6 +813,7 @@ static PHP_METHOD(HttpEnv, negotiateLanguage)
                return;
        }
        if (rs_array) {
+               ZVAL_DEREF(rs_array);
                zval_dtor(rs_array);
                array_init(rs_array);
        }
@@ -833,6 +834,7 @@ static PHP_METHOD(HttpEnv, negotiateCharset)
                return;
        }
        if (rs_array) {
+               ZVAL_DEREF(rs_array);
                zval_dtor(rs_array);
                array_init(rs_array);
        }
@@ -852,6 +854,7 @@ static PHP_METHOD(HttpEnv, negotiateEncoding)
                return;
        }
        if (rs_array) {
+               ZVAL_DEREF(rs_array);
                zval_dtor(rs_array);
                array_init(rs_array);
        }
@@ -871,6 +874,7 @@ static PHP_METHOD(HttpEnv, negotiateContentType)
                return;
        }
        if (rs_array) {
+               ZVAL_DEREF(rs_array);
                zval_dtor(rs_array);
                array_init(rs_array);
        }
@@ -894,8 +898,8 @@ static PHP_METHOD(HttpEnv, negotiate)
                return;
        }
 
-
        if (rs_array) {
+               ZVAL_DEREF(rs_array);
                zval_dtor(rs_array);
                array_init(rs_array);
        }
index dfcba3c4433851983e5802e2dfc36cf2b052fec7..6d47d99f2a78d399ca5d5fc24268aac6f97fcb66 100644 (file)
@@ -243,6 +243,7 @@ PHP_METHOD(HttpHeader, negotiate)
                return;
        }
        if (rs_array) {
+               ZVAL_DEREF(rs_array);
                zval_dtor(rs_array);
                array_init(rs_array);
        }
index 0c5b1b9736f49c2388423d4ced29a7ccd5b379ba..ff228c77f6520d5e1d8f3681576de051ef813b66 100644 (file)
@@ -1771,6 +1771,7 @@ static PHP_METHOD(HttpMessage, isMultipart)
                }
 
                if (zboundary && boundary) {
+                       ZVAL_DEREF(zboundary);
                        zval_dtor(zboundary);
                        ZVAL_STR(zboundary, php_http_cs2zs(boundary, strlen(boundary)));
                }
index 2438fc13e31aaa427a88d0e21403e565c7568d2c..eec4433fd2a606e4ec2688bc4c7289a2aeb4ff39 100644 (file)
@@ -578,7 +578,9 @@ static PHP_METHOD(HttpMessageParser, parse)
        php_http_buffer_append(&parser_obj->buffer, data_str, data_len);
        RETVAL_LONG(php_http_message_parser_parse(parser_obj->parser, &parser_obj->buffer, flags, &parser_obj->parser->message));
 
+       ZVAL_DEREF(zmsg);
        zval_dtor(zmsg);
+       ZVAL_NULL(zmsg);
        if (parser_obj->parser->message) {
                php_http_message_t *msg_cpy = php_http_message_copy(parser_obj->parser->message, NULL);
                php_http_message_object_t *msg_obj = php_http_message_object_new_ex(php_http_message_class_entry, msg_cpy);
@@ -608,7 +610,9 @@ static PHP_METHOD(HttpMessageParser, stream)
        parser_obj = PHP_HTTP_OBJ(NULL, getThis());
        RETVAL_LONG(php_http_message_parser_parse_stream(parser_obj->parser, &parser_obj->buffer, s, flags, &parser_obj->parser->message));
 
+       ZVAL_DEREF(zmsg);
        zval_dtor(zmsg);
+       ZVAL_NULL(zmsg);
        if (parser_obj->parser->message) {
                php_http_message_t *msg_cpy = php_http_message_copy(parser_obj->parser->message, NULL);
                php_http_message_object_t *msg_obj = php_http_message_object_new_ex(php_http_message_class_entry, msg_cpy);
index 1535b86c67f1c077cb49cb8337b0e99113ea5a3d..ede406f9c2a96718801c8199f67a0426ce99cc4b 100644 (file)
@@ -92,6 +92,7 @@ static int php_http_negotiate_reduce(zval *p, int num_args, va_list args, zend_h
        ZEND_HASH_FOREACH_END();
 
        if (q && Z_DVAL_P(q) > 0) {
+               Z_TRY_ADDREF_P(q);
                zend_hash_update(result, supported, q);
        }