zend_read_property API update
authorMichael Wallner <mike@php.net>
Thu, 22 Jan 2015 10:08:12 +0000 (11:08 +0100)
committerMichael Wallner <mike@php.net>
Thu, 22 Jan 2015 10:08:12 +0000 (11:08 +0100)
php_http_client.c
php_http_client_curl.c
php_http_client_request.c
php_http_client_response.c
php_http_env_request.c
php_http_env_response.c
php_http_header.c
php_http_params.c
php_http_querystring.c
tests/info.phpt

index 9672575fcc4f76a5316b686efb84d97de025d72e..f69a56fdde9c6842477e86d154b5abef8f5ed04c 100644 (file)
@@ -65,10 +65,10 @@ void php_http_client_options_set_subr(zval *instance, char *key, size_t len, zva
 {
        if (overwrite || (opts && zend_hash_num_elements(Z_ARRVAL_P(opts)))) {
                zend_class_entry *this_ce = Z_OBJCE_P(instance);
-               zval *old_opts, new_opts, *entry = NULL;
+               zval old_opts_tmp, *old_opts, new_opts, *entry = NULL;
 
                array_init(&new_opts);
-               old_opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0);
+               old_opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &old_opts_tmp);
                if (Z_TYPE_P(old_opts) == IS_ARRAY) {
                        array_copy(Z_ARRVAL_P(old_opts), Z_ARRVAL(new_opts));
                }
@@ -107,7 +107,7 @@ void php_http_client_options_set(zval *instance, zval *opts)
                zend_update_property(this_ce, instance, ZEND_STRL("options"), &new_opts);
                zval_ptr_dtor(&new_opts);
        } else {
-               zval *old_opts, add_opts, *opt;
+               zval old_opts_tmp, *old_opts, add_opts, *opt;
 
                array_init(&add_opts);
                /* some options need extra attention -- thus cannot use array_merge() directly */
@@ -119,7 +119,7 @@ void php_http_client_options_set(zval *instance, zval *opts)
                                } else if (is_client && (zend_string_equals_literal(key.key, "recordHistory") || zend_string_equals_literal(key.key, "responseMessageClass"))) {
                                        zend_update_property(this_ce, instance, key.key->val, key.key->len, opt);
                                } else if (Z_TYPE_P(opt) == IS_NULL) {
-                                       old_opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0);
+                                       old_opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &old_opts_tmp);
                                        if (Z_TYPE_P(old_opts) == IS_ARRAY) {
                                                zend_symtable_del(Z_ARRVAL_P(old_opts), key.key);
                                        }
@@ -131,7 +131,7 @@ void php_http_client_options_set(zval *instance, zval *opts)
                }
                ZEND_HASH_FOREACH_END();
 
-               old_opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0);
+               old_opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &old_opts_tmp);
                if (Z_TYPE_P(old_opts) == IS_ARRAY) {
                        array_copy(Z_ARRVAL_P(old_opts), Z_ARRVAL(new_opts));
                }
@@ -145,7 +145,7 @@ void php_http_client_options_set(zval *instance, zval *opts)
 void php_http_client_options_get_subr(zval *instance, char *key, size_t len, zval *return_value)
 {
        zend_class_entry *this_ce = Z_OBJCE_P(instance);
-       zval *options, *opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0);
+       zval *options, opts_tmp, *opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &opts_tmp);
 
        if ((Z_TYPE_P(opts) == IS_ARRAY) && (options = zend_symtable_str_find(Z_ARRVAL_P(opts), key, len))) {
                RETVAL_ZVAL_FAST(options);
@@ -351,7 +351,7 @@ zend_object *php_http_client_object_new(zend_class_entry *ce)
 
 static void handle_history(zval *zclient, php_http_message_t *request, php_http_message_t *response)
 {
-       zval new_hist, *old_hist = zend_read_property(php_http_client_class_entry, zclient, ZEND_STRL("history"), 0);
+       zval new_hist, old_hist_tmp, *old_hist = zend_read_property(php_http_client_class_entry, zclient, ZEND_STRL("history"), 0, &old_hist_tmp);
        php_http_message_t *req_copy = php_http_message_copy(request, NULL);
        php_http_message_t *res_copy = php_http_message_copy(response, NULL);
        php_http_message_t *zipped = php_http_message_zip(res_copy, req_copy);
@@ -378,13 +378,13 @@ static ZEND_RESULT_CODE handle_response(void *arg, php_http_client_t *client, ph
 
        if ((msg = *response)) {
                php_http_message_object_t *msg_obj;
-               zval info, zresponse, zrequest;
+               zval info, zresponse, zrequest, rec_hist_tmp;
                HashTable *info_ht;
 
                /* ensure the message is of type response (could be uninitialized in case of early error, like DNS) */
                php_http_message_set_type(msg, PHP_HTTP_RESPONSE);
 
-               if (zend_is_true(zend_read_property(php_http_client_class_entry, &zclient, ZEND_STRL("recordHistory"), 0))) {
+               if (zend_is_true(zend_read_property(php_http_client_class_entry, &zclient, ZEND_STRL("recordHistory"), 0, &rec_hist_tmp))) {
                        handle_history(&zclient, *request, *response);
                }
 
@@ -547,7 +547,7 @@ static HashTable *combined_options(zval *client, zval *request)
 {
        HashTable *options;
        unsigned num_options = 0;
-       zval z_roptions, *z_coptions = zend_read_property(php_http_client_class_entry, client, ZEND_STRL("options"), 0);
+       zval z_roptions, z_options_tmp, *z_coptions = zend_read_property(php_http_client_class_entry, client, ZEND_STRL("options"), 0, &z_options_tmp);
 
        if (Z_TYPE_P(z_coptions) == IS_ARRAY) {
                num_options = zend_hash_num_elements(Z_ARRVAL_P(z_coptions));
@@ -765,11 +765,11 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_getHistory, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, getHistory)
 {
-       zval *zhistory;
+       zval zhistory_tmp, *zhistory;
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
-       zhistory = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("history"), 0);
+       zhistory = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("history"), 0, &zhistory_tmp);
        RETVAL_ZVAL_FAST(zhistory);
 }
 
@@ -867,11 +867,11 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_notify, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, notify)
 {
-       zval *request = NULL, *zprogress = NULL, *observers, args[3];
+       zval *request = NULL, *zprogress = NULL, observers_tmp, *observers, args[3];
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|O!o!", &request, php_http_client_request_class_entry, &zprogress), invalid_arg, return);
 
-       observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0);
+       observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
 
        if (Z_TYPE_P(observers) != IS_OBJECT) {
                php_http_throw(unexpected_val, "Observer storage is corrupted", NULL);
@@ -908,11 +908,11 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_attach, 0, 0, 1)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, attach)
 {
-       zval *observers, *observer, retval;
+       zval observers_tmp, *observers, *observer, retval;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O", &observer, spl_ce_SplObserver), invalid_arg, return);
 
-       observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0);
+       observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
 
        if (Z_TYPE_P(observers) != IS_OBJECT) {
                php_http_throw(unexpected_val, "Observer storage is corrupted", NULL);
@@ -931,11 +931,11 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_detach, 0, 0, 1)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, detach)
 {
-       zval *observers, *observer, retval;
+       zval observers_tmp, *observers, *observer, retval;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O", &observer, spl_ce_SplObserver), invalid_arg, return);
 
-       observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0);
+       observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
 
        if (Z_TYPE_P(observers) != IS_OBJECT) {
                php_http_throw(unexpected_val, "Observer storage is corrupted", NULL);
@@ -953,11 +953,11 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_getObservers, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, getObservers)
 {
-       zval *observers;
+       zval observers_tmp, *observers;
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
-       observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0);
+       observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
 
        if (Z_TYPE_P(observers) != IS_OBJECT) {
                php_http_throw(unexpected_val, "Observer storage is corrupted", NULL);
@@ -1033,7 +1033,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, getOptions)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               zval *options = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("options"), 0);
+               zval options_tmp, *options = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("options"), 0, &options_tmp);
                RETVAL_ZVAL_FAST(options);
        }
 }
index 9881301c3dce2c62b75fe04358d69adcd71ee9ca..2e2f87aeaebe61bd8f2706731c23d143ec5b9868 100644 (file)
@@ -341,11 +341,11 @@ static int php_http_curle_dummy_callback(char *data, size_t n, size_t l, void *s
 
 static ZEND_RESULT_CODE php_http_curle_get_info(CURL *ch, HashTable *info)
 {
-       char *c;
-       long l;
-       double d;
-       struct curl_slist *s, *p;
-       zval tmp;
+       char *c = NULL;
+       long l = 0;
+       double d = 0;
+       struct curl_slist *s = NULL, *p = NULL;
+       zval tmp = {{0}};
 
        /* BEGIN::CURLINFO */
        if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_EFFECTIVE_URL, &c)) {
index 68f627e7d0514be7ca6d10732b59a4e7fa4b3832..8b473ae78ae05330f139026d4247589d1c2800f8 100644 (file)
@@ -219,7 +219,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClientRequest, getOptions)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               zval *zoptions = zend_read_property(php_http_client_request_class_entry, getThis(), ZEND_STRL("options"), 0);
+               zval tmp, *zoptions = zend_read_property(php_http_client_request_class_entry, getThis(), ZEND_STRL("options"), 0, &tmp);
                RETURN_ZVAL_FAST(zoptions);
        }
 }
index b8efb8b6a63dd2faf093aab606b4e5427e0ccada..2fe9d2c45d5fa2a87d9d3e97143f9512a16efd29 100644 (file)
@@ -91,11 +91,11 @@ static PHP_METHOD(HttpClientResponse, getTransferInfo)
 {
        char *info_name = NULL;
        size_t info_len = 0;
-       zval *info;
+       zval info_tmp, info_name_tmp, *info;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &info_name, &info_len), invalid_arg, return);
 
-       info = zend_read_property(php_http_client_response_class_entry, getThis(), ZEND_STRL("transferInfo"), 0);
+       info = zend_read_property(php_http_client_response_class_entry, getThis(), ZEND_STRL("transferInfo"), 0, &info_tmp);
 
        /* request completed? */
        if (Z_TYPE_P(info) != IS_OBJECT) {
@@ -104,7 +104,7 @@ static PHP_METHOD(HttpClientResponse, getTransferInfo)
        }
 
        if (info_len && info_name) {
-               info = zend_read_property(NULL, info, php_http_pretty_key(info_name, info_len, 0, 0), info_len, 0);
+               info = zend_read_property(NULL, info, php_http_pretty_key(info_name, info_len, 0, 0), info_len, 0, &info_name_tmp);
 
                if (!info) {
                        php_http_throw(unexpected_val, "Could not find transfer info with name '%s'", info_name);
index b1219665672bd8cfc8da68a73a309b6a70ea3550..6d1fc583c6a6da84b86a564542bd94278920f9a4 100644 (file)
@@ -164,7 +164,7 @@ static PHP_METHOD(HttpEnvRequest, __construct)
                zend_fcall_info_cache fcc; \
                zval rv, mn, *args = ecalloc(sizeof(zval), ZEND_NUM_ARGS()); \
                zval *this_ptr = getThis(); \
-               zval *qs = zend_read_property(Z_OBJCE_P(this_ptr), this_ptr, ZEND_STRL(prop), 0); \
+               zval qs_tmp, *qs = zend_read_property(Z_OBJCE_P(this_ptr), this_ptr, ZEND_STRL(prop), 0, &qs_tmp); \
                 \
                array_init(&mn); \
                Z_TRY_ADDREF_P(qs); \
@@ -191,7 +191,7 @@ static PHP_METHOD(HttpEnvRequest, getForm)
        if (ZEND_NUM_ARGS()) {
                call_querystring_get("form");
        } else {
-               zval *zform = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("form"), 0);
+               zval zform_tmp, *zform = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("form"), 0, &zform_tmp);
                RETURN_ZVAL_FAST(zform);
        }
 }
@@ -207,7 +207,7 @@ static PHP_METHOD(HttpEnvRequest, getQuery)
        if (ZEND_NUM_ARGS()) {
                call_querystring_get("query");
        } else {
-               zval *zquery = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("query"), 0);
+               zval zquery_tmp, *zquery = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("query"), 0, &zquery_tmp);
                RETURN_ZVAL_FAST(zquery);
        }
 }
@@ -223,7 +223,7 @@ static PHP_METHOD(HttpEnvRequest, getCookie)
        if (ZEND_NUM_ARGS()) {
                call_querystring_get("cookie");
        } else {
-               zval *zcookie = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("cookie"), 0);
+               zval zcookie_tmp, *zcookie = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("cookie"), 0, &zcookie_tmp);
                RETURN_ZVAL_FAST(zcookie);
        }
 }
@@ -233,7 +233,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpEnvRequest, getFiles)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               zval *zfiles = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("files"), 0);
+               zval zfiles_tmp, *zfiles = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("files"), 0, &zfiles_tmp);
                RETURN_ZVAL_FAST(zfiles);
        }
 }
index 0b195b6a7abdc7545e06931233916449bb48592f..80043a22f089ff7d562a4822c935ff2b00ee7136 100644 (file)
@@ -60,12 +60,12 @@ static void set_option(zval *options, const char *name_str, size_t name_len, int
                }
        }
 }
-static zval *get_option(zval *options, const char *name_str, size_t name_len)
+static zval *get_option(zval *options, const char *name_str, size_t name_len, zval *tmp)
 {
        zval *val = NULL;
 
        if (Z_TYPE_P(options) == IS_OBJECT) {
-               val = zend_read_property(Z_OBJCE_P(options), options, name_str, name_len, 0);
+               val = zend_read_property(Z_OBJCE_P(options), options, name_str, name_len, 0, tmp);
        } else if (Z_TYPE_P(options) == IS_ARRAY) {
                val = zend_symtable_str_find(Z_ARRVAL_P(options), name_str, name_len);
        } else {
@@ -78,10 +78,10 @@ static zval *get_option(zval *options, const char *name_str, size_t name_len)
 }
 static php_http_message_body_t *get_body(zval *options)
 {
-       zval *zbody;
+       zval zbody_tmp, *zbody;
        php_http_message_body_t *body = NULL;
 
-       if ((zbody = get_option(options, ZEND_STRL("body")))) {
+       if ((zbody = get_option(options, ZEND_STRL("body"), &zbody_tmp))) {
                if ((Z_TYPE_P(zbody) == IS_OBJECT) && instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_class_entry)) {
                        php_http_message_body_object_t *body_obj = PHP_HTTP_OBJ(NULL, zbody);
 
@@ -94,10 +94,10 @@ static php_http_message_body_t *get_body(zval *options)
 }
 static php_http_message_t *get_request(zval *options)
 {
-       zval *zrequest;
+       zval zrequest_tmp, *zrequest;
        php_http_message_t *request = NULL;
 
-       if ((zrequest = get_option(options, ZEND_STRL("request")))) {
+       if ((zrequest = get_option(options, ZEND_STRL("request"), &zrequest_tmp))) {
                if (Z_TYPE_P(zrequest) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zrequest), php_http_message_class_entry)) {
                        php_http_message_object_t *request_obj = PHP_HTTP_OBJ(NULL, zrequest);
 
@@ -110,12 +110,12 @@ static php_http_message_t *get_request(zval *options)
 }
 static void set_cookie(zval *options, zval *zcookie_new)
 {
-       zval tmp, *zcookies_set;
+       zval tmp, zcookies_set_tmp, *zcookies_set;
        php_http_arrkey_t key;
        php_http_cookie_object_t *obj = PHP_HTTP_OBJ(NULL, zcookie_new);
 
        array_init(&tmp);
-       zcookies_set = get_option(options, ZEND_STRL("cookies"));
+       zcookies_set = get_option(options, ZEND_STRL("cookies"), &zcookies_set_tmp);
        if (zcookies_set && Z_TYPE_P(zcookies_set) == IS_ARRAY) {
                array_copy(Z_ARRVAL_P(zcookies_set), Z_ARRVAL(tmp));
                zval_ptr_dtor(zcookies_set);
@@ -141,14 +141,14 @@ php_http_cache_status_t php_http_env_is_response_cached_by_etag(zval *options, c
        php_http_cache_status_t ret = PHP_HTTP_CACHE_NO;
        char *header = NULL, *etag = NULL;
        php_http_message_body_t *body;
-       zval *zetag;
+       zval zetag_tmp, *zetag;
 
 
        if (!(body = get_body(options))) {
                return ret;
        }
 
-       if ((zetag = get_option(options, ZEND_STRL("etag"))) && Z_TYPE_P(zetag) != IS_NULL) {
+       if ((zetag = get_option(options, ZEND_STRL("etag"), &zetag_tmp)) && Z_TYPE_P(zetag) != IS_NULL) {
                zend_string *zs = zval_get_string(zetag);
                etag = estrndup(zs->val, zs->len);
                zend_string_release(zs);
@@ -175,13 +175,13 @@ php_http_cache_status_t php_http_env_is_response_cached_by_last_modified(zval *o
        char *header;
        time_t ums, lm = 0;
        php_http_message_body_t *body;
-       zval *zlm;
+       zval zlm_tmp, *zlm;
 
        if (!(body = get_body(options))) {
                return ret;
        }
 
-       if ((zlm = get_option(options, ZEND_STRL("lastModified")))) {
+       if ((zlm = get_option(options, ZEND_STRL("lastModified"), &zlm_tmp))) {
                lm = zval_get_long(zlm);
                zval_ptr_dtor(zlm);
        }
@@ -331,13 +331,13 @@ void php_http_env_response_free(php_http_env_response_t **r)
 static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t *r, php_http_message_t *request)
 {
        ZEND_RESULT_CODE ret = SUCCESS;
-       zval *zoption, *options = &r->options;
+       zval zoption_tmp, *zoption, *options = &r->options;
 
        if (r->done) {
                return ret;
        }
 
-       if ((zoption = get_option(options, ZEND_STRL("headers")))) {
+       if ((zoption = get_option(options, ZEND_STRL("headers"), &zoption_tmp))) {
                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);
                }
@@ -348,7 +348,7 @@ static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t
                return ret;
        }
 
-       if ((zoption = get_option(options, ZEND_STRL("responseCode")))) {
+       if ((zoption = get_option(options, ZEND_STRL("responseCode"), &zoption_tmp))) {
                zend_long rc = zval_get_long(zoption);
 
                zval_ptr_dtor(zoption);
@@ -361,7 +361,7 @@ static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t
                return ret;
        }
 
-       if ((zoption = get_option(options, ZEND_STRL("httpVersion")))) {
+       if ((zoption = get_option(options, ZEND_STRL("httpVersion"), &zoption_tmp))) {
                php_http_version_t v;
                zend_string *zs = zval_get_string(zoption);
 
@@ -377,7 +377,7 @@ static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t
                return ret;
        }
 
-       if ((zoption = get_option(options, ZEND_STRL("cookies")))) {
+       if ((zoption = get_option(options, ZEND_STRL("cookies"), &zoption_tmp))) {
                if (Z_TYPE_P(zoption) == IS_ARRAY) {
                        zval *zcookie;
 
@@ -405,7 +405,7 @@ static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t
                return ret;
        }
 
-       if ((zoption = get_option(options, ZEND_STRL("contentType")))) {
+       if ((zoption = get_option(options, ZEND_STRL("contentType"), &zoption_tmp))) {
                zend_string *zs = zval_get_string(zoption);
 
                zval_ptr_dtor(zoption);
@@ -443,7 +443,7 @@ static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t
                        }
                }
        } else {
-               if ((zoption = get_option(options, ZEND_STRL("cacheControl")))) {
+               if ((zoption = get_option(options, ZEND_STRL("cacheControl"), &zoption_tmp))) {
                        zend_string *zs = zval_get_string(zoption);
 
                        zval_ptr_dtor(zoption);
@@ -457,7 +457,7 @@ static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t
                        return ret;
                }
 
-               if ((zoption = get_option(options, ZEND_STRL("contentDisposition")))) {
+               if ((zoption = get_option(options, ZEND_STRL("contentDisposition"), &zoption_tmp))) {
 
                        if (Z_TYPE_P(zoption) == IS_ARRAY) {
                                php_http_buffer_t buf;
@@ -478,7 +478,7 @@ static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t
                        return ret;
                }
 
-               if ((zoption = get_option(options, ZEND_STRL("contentEncoding")))) {
+               if ((zoption = get_option(options, ZEND_STRL("contentEncoding"), &zoption_tmp))) {
                        zend_long ce = zval_get_long(zoption);
                        zval zsupported;
                        HashTable *result = NULL;
@@ -553,7 +553,7 @@ static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t
                                        break;
                        }
 
-                       if ((zoption = get_option(options, ZEND_STRL("etag")))) {
+                       if ((zoption = get_option(options, ZEND_STRL("etag"), &zoption_tmp))) {
                                zend_string *zs = zval_get_string(zoption);
 
                                zval_ptr_dtor(zoption);
@@ -564,7 +564,7 @@ static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t
                                }
                                zend_string_release(zs);
                        }
-                       if ((zoption = get_option(options, ZEND_STRL("lastModified") TSRMLS_CC))) {
+                       if ((zoption = get_option(options, ZEND_STRL("lastModified"), &zoption_tmp))) {
                                zend_long lm = zval_get_long(zoption);
 
                                zval_ptr_dtor(zoption);
@@ -585,7 +585,7 @@ static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t
 static ZEND_RESULT_CODE php_http_env_response_send_body(php_http_env_response_t *r)
 {
        ZEND_RESULT_CODE ret = SUCCESS;
-       zval *zoption;
+       zval zoption_tmp, *zoption;
        php_http_message_body_t *body;
 
        if (r->done) {
@@ -593,11 +593,11 @@ static ZEND_RESULT_CODE php_http_env_response_send_body(php_http_env_response_t
        }
 
        if ((body = get_body(&r->options))) {
-               if ((zoption = get_option(&r->options, ZEND_STRL("throttleDelay")))) {
+               if ((zoption = get_option(&r->options, ZEND_STRL("throttleDelay"), &zoption_tmp))) {
                        r->throttle.delay = zval_get_double(zoption);
                        zval_ptr_dtor(zoption);
                }
-               if ((zoption = get_option(&r->options, ZEND_STRL("throttleChunk") TSRMLS_CC))) {
+               if ((zoption = get_option(&r->options, ZEND_STRL("throttleChunk"), &zoption_tmp))) {
                        r->throttle.chunk = zval_get_long(zoption);
                        zval_ptr_dtor(zoption);
                }
index bbf6a9e085dccc46cf4465d39bbda52d55909a5e..4651ef5a5d6cfca1abd695f154f36876a7733ed0 100644 (file)
@@ -149,13 +149,14 @@ PHP_METHOD(HttpHeader, serialize)
        if (SUCCESS == zend_parse_parameters_none()) {
                php_http_buffer_t buf;
                zend_string *zs;
+               zval name_tmp, value_tmp;
 
                php_http_buffer_init(&buf);
-               zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("name"), 0));
+               zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("name"), 0, &name_tmp));
                php_http_buffer_appendz(&buf, zs);
                zend_string_release(zs);
 
-               zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0));
+               zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0, &value_tmp));
                if (zs->len) {
                        php_http_buffer_appends(&buf, ": ");
                        php_http_buffer_appendz(&buf, zs);
@@ -217,12 +218,13 @@ PHP_METHOD(HttpHeader, match)
        size_t val_len;
        zend_long flags = PHP_HTTP_MATCH_LOOSE;
        zend_string *zs;
+       zval value_tmp;
 
        if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "|sl", &val_str, &val_len, &flags)) {
                return;
        }
 
-       zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0));
+       zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0, &value_tmp));
        RETVAL_BOOL(php_http_match(zs->val, val_str, flags));
        zend_string_release(zs);
 }
@@ -234,7 +236,7 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpHeader, negotiate)
 {
        HashTable *supported, *rs;
-       zval *rs_array = NULL;
+       zval name_tmp, value_tmp, *rs_array = NULL;
        zend_string *zs;
        char *sep_str = NULL;
        size_t sep_len = 0;
@@ -248,7 +250,7 @@ PHP_METHOD(HttpHeader, negotiate)
                array_init(rs_array);
        }
 
-       zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("name"), 0));
+       zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("name"), 0, &name_tmp));
        if (zend_string_equals_literal(zs, "Accept")) {
                sep_str = "/";
                sep_len = 1;
@@ -258,7 +260,7 @@ PHP_METHOD(HttpHeader, negotiate)
        }
        zend_string_release(zs);
 
-       zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0));
+       zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0, &value_tmp));
        if ((rs = php_http_negotiate(zs->val, zs->len, supported, sep_str, sep_len))) {
                PHP_HTTP_DO_NEGOTIATE_HANDLE_RESULT(rs, supported, rs_array);
        } else {
@@ -275,14 +277,14 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_getParams, 0, 0, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpHeader, getParams)
 {
-       zval zctor, zparams_obj, *zargs = NULL;
+       zval value_tmp, zctor, zparams_obj, *zargs = NULL;
        
        ZVAL_STRINGL(&zctor, "__construct", lenof("__construct"));
        
        object_init_ex(&zparams_obj, php_http_params_class_entry);
        
        zargs = (zval *) ecalloc(ZEND_NUM_ARGS()+1, sizeof(zval));
-       ZVAL_COPY_VALUE(&zargs[0], zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0));
+       ZVAL_COPY_VALUE(&zargs[0], zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0, &value_tmp));
        if (ZEND_NUM_ARGS()) {
                zend_get_parameters_array(ZEND_NUM_ARGS(), ZEND_NUM_ARGS(), &zargs[1]);
        }
index 7dbffb98d72b08584d19bd77c149861491d5923b..74ddf1f8955c2592e2e0f043929aefdd49af190a 100644 (file)
@@ -968,9 +968,9 @@ PHP_METHOD(HttpParams, __construct)
 
                                                php_http_params_opts_t opts = {
                                                        {zs->val, zs->len},
-                                                       php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), 0)),
-                                                       php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), 0)),
-                                                       php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), 0)),
+                                                       php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), 0, &tmp)),
+                                                       php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), 0, &tmp)),
+                                                       php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), 0, &tmp)),
                                                        {{0}}, flags
                                                };
 
@@ -1001,12 +1001,12 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_toArray, 0, 0, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpParams, toArray)
 {
-       zval *zparams;
+       zval zparams_tmp, *zparams;
 
        if (SUCCESS != zend_parse_parameters_none()) {
                return;
        }
-       zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0);
+       zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp);
        RETURN_ZVAL_FAST(zparams);
 }
 
@@ -1015,27 +1015,28 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpParams, toString)
 {
        zval *tmp, *zparams, *zpsep, *zasep, *zvsep;
+       zval zparams_tmp, flags_tmp, psep_tmp, asep_tmp, vsep_tmp;
        zend_string *psep, *asep, *vsep;
        long flags;
        php_http_buffer_t buf;
 
-       zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0);
+       zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp);
        convert_to_array_ex(zparams);
-       flags = zval_get_long(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("flags"), 0));
+       flags = zval_get_long(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("flags"), 0, &flags_tmp));
 
-       zpsep = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), 0);
+       zpsep = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), 0, &psep_tmp);
        if (Z_TYPE_P(zpsep) == IS_ARRAY && (tmp = zend_hash_get_current_data(Z_ARRVAL_P(zpsep)))) {
                psep = zval_get_string(tmp);
        } else {
                psep = zval_get_string(zpsep);
        }
-       zasep = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), 0);
+       zasep = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), 0, &asep_tmp);
        if (Z_TYPE_P(zasep) == IS_ARRAY && (tmp = zend_hash_get_current_data(Z_ARRVAL_P(zasep)))) {
                asep = zval_get_string(tmp);
        } else {
                asep = zval_get_string(zasep);
        }
-       zvsep = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), 0);
+       zvsep = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), 0, &vsep_tmp);
        if (Z_TYPE_P(zvsep) == IS_ARRAY && (tmp = zend_hash_get_current_data(Z_ARRVAL_P(zvsep)))) {
                vsep = zval_get_string(tmp);
        } else {
@@ -1058,13 +1059,13 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpParams, offsetExists)
 {
        zend_string *name;
-       zval *zparam, *zparams;
+       zval zparams_tmp, *zparam, *zparams;
 
        if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name)) {
                return;
        }
 
-       zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0);
+       zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp);
 
        if (Z_TYPE_P(zparams) == IS_ARRAY && (zparam = zend_symtable_find(Z_ARRVAL_P(zparams), name))) {
                RETVAL_BOOL(Z_TYPE_P(zparam) != IS_NULL);
@@ -1079,13 +1080,13 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpParams, offsetGet)
 {
        zend_string *name;
-       zval *zparam, *zparams;
+       zval zparams_tmp, *zparam, *zparams;
 
        if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name)) {
                return;
        }
 
-       zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0);
+       zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp);
 
        if (Z_TYPE_P(zparams) == IS_ARRAY && (zparam = zend_symtable_find(Z_ARRVAL_P(zparams), name))) {
                RETVAL_ZVAL_FAST(zparam);
@@ -1098,13 +1099,13 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpParams, offsetUnset)
 {
        zend_string *name;
-       zval *zparams;
+       zval zparams_tmp, *zparams;
 
        if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name)) {
                return;
        }
 
-       zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0);
+       zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp);
 
        if (Z_TYPE_P(zparams) == IS_ARRAY) {
                zend_symtable_del(Z_ARRVAL_P(zparams), name);
@@ -1118,13 +1119,13 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpParams, offsetSet)
 {
        zend_string *name;
-       zval *zparam, *zparams, *nvalue;
+       zval zparams_tmp, *zparam, *zparams, *nvalue;
 
        if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &name, &nvalue)) {
                return;
        }
 
-       zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0);
+       zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp);
        convert_to_array(zparams);
 
        if (name->len) {
index d861102e89d72c75993b0d69c841dbe89db3c304..0aeb4541d081f8290d5b34b2cbf859b9e52958d2 100644 (file)
@@ -29,7 +29,7 @@ static inline void php_http_querystring_set(zval *instance, zval *params, int fl
        array_init(&qa);
 
        if (flags & QS_MERGE) {
-               zval *old = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0);
+               zval old_tmp, *old = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0, &old_tmp);
 
                ZVAL_DEREF(old);
                if (Z_TYPE_P(old) == IS_ARRAY) {
@@ -44,7 +44,7 @@ static inline void php_http_querystring_set(zval *instance, zval *params, int fl
 
 static inline void php_http_querystring_str(zval *instance, zval *return_value)
 {
-       zval *qa = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0);
+       zval qa_tmp, *qa = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0, &qa_tmp);
 
        ZVAL_DEREF(qa);
        if (Z_TYPE_P(qa) == IS_ARRAY) {
@@ -54,9 +54,9 @@ static inline void php_http_querystring_str(zval *instance, zval *return_value)
        }
 }
 
-static inline void php_http_querystring_get(zval *instance, int type, char *name, uint name_len, zval *defval, zend_bool del, zval *return_value TSRMLS_DC)
+static inline void php_http_querystring_get(zval *instance, int type, char *name, uint name_len, zval *defval, zend_bool del, zval *return_value)
 {
-       zval *arrval, *qarray = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0 TSRMLS_CC);
+       zval *arrval, qarray_tmp, *qarray = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0, &qarray_tmp);
 
        ZVAL_DEREF(qarray);
        if ((Z_TYPE_P(qarray) == IS_ARRAY) && (arrval = zend_symtable_str_find(Z_ARRVAL_P(qarray), name, name_len))) {
@@ -224,7 +224,7 @@ ZEND_RESULT_CODE php_http_querystring_update(zval *qarray, zval *params, zval *o
 
                /* squeeze the hash out of the zval */
                if (Z_TYPE_P(params) == IS_OBJECT && instanceof_function(Z_OBJCE_P(params), php_http_querystring_class_entry)) {
-                       zval *qa = zend_read_property(php_http_querystring_class_entry, params, ZEND_STRL("queryArray"), 0);
+                       zval qa_tmp, *qa = zend_read_property(php_http_querystring_class_entry, params, ZEND_STRL("queryArray"), 0, &qa_tmp);
 
                        ZVAL_DEREF(qa);
                        convert_to_array(qa);
@@ -368,11 +368,11 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_getIterator, 0, 0, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, getIterator)
 {
-       zval *qa;
+       zval qa_tmp, *qa;
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
-       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0);
+       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &qa_tmp);
 
        object_init_ex(return_value, spl_ce_RecursiveArrayIterator);
        zend_call_method_with_1_params(return_value, spl_ce_RecursiveArrayIterator, NULL, "__construct", NULL, qa);
@@ -392,13 +392,13 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_toArray, 0, 0, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, toArray)
 {
-       zval *zqa;
+       zval zqa_tmp, *zqa;
 
        if (SUCCESS != zend_parse_parameters_none()) {
                return;
        }
 
-       zqa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0);
+       zqa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &zqa_tmp);
        RETURN_ZVAL_FAST(zqa);
 }
 
@@ -469,7 +469,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_mod, 0, 0, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, mod)
 {
-       zval *params, *instance = getThis();
+       zval qa_tmp, *params, *instance = getThis();
        zend_error_handling zeh;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "z", &params), invalid_arg, return);
@@ -477,7 +477,7 @@ PHP_METHOD(HttpQueryString, mod)
        zend_replace_error_handling(EH_THROW, php_http_exception_bad_querystring_class_entry, &zeh);
        ZVAL_OBJ(return_value, Z_OBJ_HT_P(instance)->clone_obj(instance));
        /* make sure we do not inherit the reference to _GET */
-       SEPARATE_ZVAL(zend_read_property(Z_OBJCE_P(return_value), return_value, ZEND_STRL("queryArray"), 0));
+       SEPARATE_ZVAL(zend_read_property(Z_OBJCE_P(return_value), return_value, ZEND_STRL("queryArray"), 0, &qa_tmp));
        php_http_querystring_set(return_value, params, QS_MERGE);
        zend_restore_error_handling(&zeh);
 }
@@ -514,12 +514,12 @@ PHP_METHOD(HttpQueryString, xlate)
 {
        char *ie, *oe;
        size_t ie_len, oe_len;
-       zval na, *qa;
+       zval na, qa_tmp, *qa;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &ie, &ie_len, &oe, &oe_len), invalid_arg, return);
 
        array_init(&na);
-       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0);
+       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &qa_tmp);
        ZVAL_DEREF(qa);
        convert_to_array(qa);
 
@@ -569,13 +569,13 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetGet)
 {
        zend_string *offset;
-       zval *value, *qa;
+       zval *value, qa_tmp, *qa;
 
        if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) {
                return;
        }
        
-       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0);
+       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &qa_tmp);
        ZVAL_DEREF(qa);
 
        if (Z_TYPE_P(qa) == IS_ARRAY) {
@@ -611,13 +611,13 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetExists)
 {
        zend_string *offset;
-       zval *value, *qa;
+       zval *value, qa_tmp, *qa;
 
        if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) {
                return;
        }
        
-       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0);
+       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &qa_tmp);
        ZVAL_DEREF(qa);
 
        if (Z_TYPE_P(qa) == IS_ARRAY) {
index 373cb45e1ad11873b608042a5dee158ab02cdd8e..c1f58d93269c215dba5d64e974fe52c9fa2ec744 100644 (file)
@@ -14,6 +14,6 @@ Done
 Test
 %a
 HTTP Support => enabled
-Extension Version => 2.%s
+Extension Version => 3.%s
 %a
 Done