com php-src: Merge branch 'PHP-5.6': ext/soap/php_encoding. c ext/soap/php_http.c ext/soap/soap.c

From: Date: Tue, 03 Mar 2015 07:19:12 +0000
Subject: com php-src: Merge branch 'PHP-5.6': ext/soap/php_encoding. c ext/soap/php_http.c ext/soap/soap.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-85157@lists.php.net to get a copy of this message
Commit: dd50ed8a34d9d04c7f3b532e112be0453920c3a5 Author: Dmitry Stogov <dmitry@zend.com> Tue, 3 Mar 2015 10:19:12 +0300 Parents: a64e12e2a12e7a8bd98ed64232dcaa8c510c3978 26827a011186ebb0c0cbabe588e7717caf4d4327 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dd50ed8a34d9d04c7f3b532e112be0453920c3a5 Log: Merge branch 'PHP-5.6' * PHP-5.6: Added type checks Fixed bug #67741 (auto_prepend_file messes up __LINE__) Check variable type before its usage as IS_ARRAY. Fixed a bug that header value is not terminated by '\0' when accessed through getenv(). Conflicts: ext/soap/php_encoding.c ext/soap/php_http.c ext/soap/soap.c Bugs: https://bugs.php.net/67741 Changed paths: MM ext/soap/php_encoding..c MM ext/soap/php_http.c MM ext/soap/soap.c

diff --cc ext/soap/php_encoding.c index 3ac5a7b,20502e5..9866d94 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@@ -3508,25 -3628,32 +3508,28 @@@ static encodePtr get_array_type(xmlNode different = FALSE; cur_type = prev_type = 0; ht = HASH_OF(array); - count = zend_hash_num_elements(ht); - zend_hash_internal_pointer_reset(ht); - for (i = 0;i < count;i++) { - zend_hash_get_current_data(ht, (void **)&tmp); + ZEND_HASH_FOREACH_VAL_IND(ht, tmp) { + if (Z_TYPE_P(tmp) == IS_OBJECT && + Z_OBJCE_P(tmp) == soap_var_class_entry) { + zval *ztype; - if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL) { - if (Z_TYPE_PP(tmp) == IS_OBJECT && - Z_OBJCE_PP(tmp) == soap_var_class_entry) { - zval **ztype; - - if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE || - Z_TYPE_PP(ztype) != IS_LONG) { ++ if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL || ++ Z_TYPE_P(ztype) != IS_LONG) { soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property"); } - cur_type = Z_LVAL_PP(ztype); + cur_type = Z_LVAL_P(ztype); - if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL) { - if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_stype", sizeof("enc_stype"), (void **)&ztype) == SUCCESS && - Z_TYPE_PP(ztype) == IS_STRING) { - cur_stype = Z_STRVAL_PP(ztype); ++ if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL && ++ Z_TYPE_P(ztype) == IS_STRING) { + cur_stype = Z_STRVAL_P(ztype); } else { cur_stype = NULL; } - if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_ns", sizeof("enc_ns")-1)) != NULL) { - if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_ns", sizeof("enc_ns"), (void **)&ztype) == SUCCESS && - Z_TYPE_PP(ztype) == IS_STRING) { - cur_ns = Z_STRVAL_PP(ztype); ++ if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_ns", sizeof("enc_ns")-1)) != NULL && ++ Z_TYPE_P(ztype) == IS_STRING) { + cur_ns = Z_STRVAL_P(ztype); } else { cur_ns = NULL; } diff --cc ext/soap/php_http.c index db0e3c1,2045162..645d1f2 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@@ -32,25 -32,28 +32,27 @@@ static zend_string *get_http_headers(ph smart_str_appendl(str,const,sizeof(const)-1) /* Proxy HTTP Authentication */ -int proxy_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC) +int proxy_authentication(zval* this_ptr, smart_str* soap_headers) { - zval **login, **password; + zval *login, *password; - if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_login", sizeof("_proxy_login")-1)) != NULL) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_login", sizeof("_proxy_login"), (void **)&login) == SUCCESS && - Z_TYPE_PP(login) == IS_STRING) { - unsigned char* buf; - int len; ++ if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_login", sizeof("_proxy_login")-1)) != NULL && ++ Z_TYPE_P(login) == IS_STRING) { + zend_string *buf; smart_str auth = {0}; - smart_str_appendl(&auth, Z_STRVAL_PP(login), Z_STRLEN_PP(login)); + smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login)); smart_str_appendc(&auth, ':'); - if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password")-1)) != NULL) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password"), (void **)&password) == SUCCESS && - Z_TYPE_PP(password) == IS_STRING) { - smart_str_appendl(&auth, Z_STRVAL_PP(password), Z_STRLEN_PP(password)); ++ if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password")-1)) != NULL && ++ Z_TYPE_P(password) == IS_STRING) { + smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password)); } smart_str_0(&auth); - buf = php_base64_encode((unsigned char*)auth.c, auth.len, &len); + buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len); smart_str_append_const(soap_headers, "Proxy-Authorization: Basic "); - smart_str_appendl(soap_headers, (char*)buf, len); + smart_str_appendl(soap_headers, (char*)buf->val, buf->len); smart_str_append_const(soap_headers, "\r\n"); - efree(buf); + zend_string_release(buf); smart_str_free(&auth); return 1; } @@@ -58,26 -61,29 +60,28 @@@ } /* HTTP Authentication */ -int basic_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC) +int basic_authentication(zval* this_ptr, smart_str* soap_headers) { - zval **login, **password; + zval *login, *password; - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login"), (void **)&login) == SUCCESS && - Z_TYPE_PP(login) == IS_STRING && - !zend_hash_exists(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest"))) { - unsigned char* buf; - int len; + if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login")-1)) != NULL && - !zend_hash_str_exists(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest")-1)) { ++ Z_TYPE_P(login) == IS_STRING && ++ !zend_hash_str_exists(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest")-1)) { + zend_string* buf; smart_str auth = {0}; - smart_str_appendl(&auth, Z_STRVAL_PP(login), Z_STRLEN_PP(login)); + smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login)); smart_str_appendc(&auth, ':'); - if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password"), (void **)&password) == SUCCESS && - Z_TYPE_PP(password) == IS_STRING) { - smart_str_appendl(&auth, Z_STRVAL_PP(password), Z_STRLEN_PP(password)); ++ if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL && ++ Z_TYPE_P(password) == IS_STRING) { + smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password)); } smart_str_0(&auth); - buf = php_base64_encode((unsigned char*)auth.c, auth.len, &len); + buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len); smart_str_append_const(soap_headers, "Authorization: Basic "); - smart_str_appendl(soap_headers, (char*)buf, len); + smart_str_appendl(soap_headers, (char*)buf->val, buf->len); smart_str_append_const(soap_headers, "\r\n"); - efree(buf); + zend_string_release(buf); smart_str_free(&auth); return 1; } @@@ -564,8 -574,9 +568,8 @@@ try_again smart_str_append_unsigned(&soap_headers, phpurl->port); } if (!http_1_1 || - (zend_hash_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive"), (void **)&tmp) == SUCCESS && - (Z_TYPE_PP(tmp) == IS_BOOL || Z_TYPE_PP(tmp) == IS_LONG) && - Z_LVAL_PP(tmp) == 0)) { + ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive")-1)) != NULL && - Z_LVAL_P(tmp) == 0)) { ++ (Z_TYPE_P(tmp) == IS_FALSE || (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0)))) { smart_str_append_const(&soap_headers, "\r\n" "Connection: close\r\n"); } else { @@@ -797,9 -809,11 +801,10 @@@ } /* Send cookies along with request */ - if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) != NULL) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS && - Z_TYPE_PP(cookies) == IS_ARRAY) { - zval **data; - char *key; - uint key_len; ++ if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) != NULL && ++ Z_TYPE_P(cookies) == IS_ARRAY) { + zval *data; + zend_string *key; int i, n; has_cookies = 1; @@@ -839,9 -853,9 +844,9 @@@ smart_str_append_const(&soap_headers, "\r\n"); smart_str_0(&soap_headers); - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS && - (Z_TYPE_PP(trace) == IS_BOOL || Z_TYPE_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) { - add_property_stringl(this_ptr, "__last_request_headers", soap_headers.c, soap_headers.len, 1); + if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_LVAL_P(trace) > 0) { ++ (Z_TYPE_P(trace) == IS_TRUE || (Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) != 0))) { + add_property_stringl(this_ptr, "__last_request_headers", soap_headers.s->val, soap_headers.s->len); } smart_str_appendl(&soap_headers, request, request_size); smart_str_0(&soap_headers); @@@ -884,9 -898,9 +889,9 @@@ return FALSE; } - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS && - (Z_TYPE_PP(trace) == IS_BOOL || Z_TYPE_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) { - add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size, 1); + if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_LVAL_P(trace) > 0) { ++ (Z_TYPE_P(trace) == IS_TRUE || (Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) != 0))) { + add_property_str(this_ptr, "__last_response_headers", zend_string_copy(http_headers)); } /* Check to see what HTTP status was sent */ @@@ -928,18 -942,21 +933,19 @@@ we shouldn't be changing urls so path dont matter too much */ - cookie_itt = strstr(http_headers,"Set-Cookie: "); + cookie_itt = strstr(http_headers->val, "Set-Cookie: "); while (cookie_itt) { - char *end_pos, *cookie; + char *cookie; char *eqpos, *sempos; - zval **cookies; - - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == FAILURE || - Z_TYPE_PP(cookies) != IS_ARRAY) { - zval *tmp_cookies; - MAKE_STD_ZVAL(tmp_cookies); - array_init(tmp_cookies); - zend_hash_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), &tmp_cookies, sizeof(zval *), (void **)&cookies); + zval *cookies; + - if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) == NULL) { ++ if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) == NULL || ++ Z_TYPE_P(cookies) != IS_ARRAY) { + zval tmp_cookies; + array_init(&tmp_cookies); + cookies = zend_hash_str_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1, &tmp_cookies); } - end_pos = strstr(cookie_itt,"\r\n"); cookie = get_http_header_value(cookie_itt,"Set-Cookie: "); eqpos = strstr(cookie, "="); diff --cc ext/soap/soap.c index 3a27f7a,1b8ceae..a4f4ab5 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@@ -2580,39 -2562,45 +2580,39 @@@ static int do_request(zval *this_ptr, x return FALSE; } - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS && - (Z_LVAL_PP(trace) == IS_BOOL || Z_LVAL_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) { - add_property_stringl(this_ptr, "__last_request", buf, buf_size, 1); + if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) > 0) { ++ (Z_TYPE_P(trace) == IS_TRUE || (Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) != 0))) { + add_property_stringl(this_ptr, "__last_request", buf, buf_size); } - INIT_ZVAL(func); - ZVAL_STRINGL(&func,"__doRequest",sizeof("__doRequest")-1,0); - ALLOC_INIT_ZVAL(params[0]); - ZVAL_STRINGL(params[0], buf, buf_size, 1); - ALLOC_INIT_ZVAL(params[1]); + ZVAL_STRINGL(&func,"__doRequest",sizeof("__doRequest")-1); + ZVAL_STRINGL(&params[0], buf, buf_size); if (location == NULL) { - ZVAL_NULL(params[1]); + ZVAL_NULL(&params[1]); } else { - ZVAL_STRING(params[1], location, 1); + ZVAL_STRING(&params[1], location); } - ALLOC_INIT_ZVAL(params[2]); if (action == NULL) { - ZVAL_NULL(params[2]); + ZVAL_NULL(&params[2]); } else { - ZVAL_STRING(params[2], action, 1); + ZVAL_STRING(&params[2], action); } - ALLOC_INIT_ZVAL(params[3]); - ZVAL_LONG(params[3], version); + ZVAL_LONG(&params[3], version); + ZVAL_LONG(&params[4], one_way); - ALLOC_INIT_ZVAL(params[4]); - ZVAL_LONG(params[4], one_way); - - if (call_user_function(NULL, &this_ptr, &func, response, 5, params TSRMLS_CC) != SUCCESS) { - add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() failed", NULL, NULL TSRMLS_CC); + if (call_user_function(NULL, this_ptr, &func, response, 5, params) != SUCCESS) { + add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() failed", NULL, NULL); ret = FALSE; } else if (Z_TYPE_P(response) != IS_STRING) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == FAILURE) { - add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() returned non string value", NULL, NULL TSRMLS_CC); + if ((fault = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault")-1)) == NULL) { + add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() returned non string value", NULL, NULL); } ret = FALSE; - } else if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS && - (Z_LVAL_PP(trace) == IS_BOOL || Z_LVAL_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) { - add_property_stringl(this_ptr, "__last_response", Z_STRVAL_P(response), Z_STRLEN_P(response), 1); + } else if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) > 0) { ++ (Z_TYPE_P(trace) == IS_TRUE || (Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) != 0))) { + add_property_str(this_ptr, "__last_response", zend_string_copy(Z_STR_P(response))); } + zval_ptr_dtor(&func); zval_ptr_dtor(&params[4]); zval_ptr_dtor(&params[3]); zval_ptr_dtor(&params[2]); @@@ -2655,13 -2642,13 +2655,13 @@@ static void do_soap_call(zend_execute_d SOAP_CLIENT_BEGIN_CODE(); - if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL - && Z_LVAL_P(trace) > 0) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS && - (Z_LVAL_PP(trace) == IS_BOOL || Z_LVAL_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) { - zend_hash_del(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request")); - zend_hash_del(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response")); ++ if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && ++ (Z_TYPE_P(trace) == IS_TRUE || (Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) != 0))) { + zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request")-1); + zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response")-1); } - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_soap_version", sizeof("_soap_version")-1)) != NULL - && Z_LVAL_P(tmp) == SOAP_1_2) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_soap_version", sizeof("_soap_version"), (void **) &tmp) == SUCCESS && - Z_TYPE_PP(tmp) == IS_LONG && Z_LVAL_PP(tmp) == SOAP_1_2) { ++ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_soap_version", sizeof("_soap_version")-1)) != NULL && ++ Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == SOAP_1_2) { soap_version = SOAP_1_2; } else { soap_version = SOAP_1_1; @@@ -2755,18 -2742,18 +2755,18 @@@ smart_str_free(&error); } } else { - zval **uri; + zval *uri; smart_str action = {0}; - if ((uri = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri")-1)) == NULL) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri"), (void *)&uri) == FAILURE || Z_TYPE_PP(uri) != IS_STRING) { - add_soap_fault(this_ptr, "Client", "Error finding \"uri\" property", NULL, NULL TSRMLS_CC); ++ if ((uri = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri")-1)) == NULL || Z_TYPE_P(uri) != IS_STRING) { + add_soap_fault(this_ptr, "Client", "Error finding \"uri\" property", NULL, NULL); } else if (location == NULL) { - add_soap_fault(this_ptr, "Client", "Error could not find \"location\" property", NULL, NULL TSRMLS_CC); + add_soap_fault(this_ptr, "Client", "Error could not find \"location\" property", NULL, NULL); } else { if (call_uri == NULL) { - call_uri = Z_STRVAL_PP(uri); + call_uri = Z_STRVAL_P(uri); } - request = serialize_function_call(this_ptr, NULL, function, call_uri, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); + request = serialize_function_call(this_ptr, NULL, function, call_uri, real_args, arg_count, soap_version, soap_headers); if (soap_action == NULL) { smart_str_appends(&action, call_uri); @@@ -3018,8 -3024,9 +3018,9 @@@ PHP_METHOD(SoapClient, __getLastRequest return; } - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request", sizeof("__last_request")-1)) != NULL) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request"), (void **)&tmp) == SUCCESS && - Z_TYPE_PP(tmp) == IS_STRING) { - RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); ++ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request", sizeof("__last_request")-1)) != NULL && ++ Z_TYPE_P(tmp) == IS_STRING) { + RETURN_STR(zend_string_copy(Z_STR_P(tmp))); } RETURN_NULL(); } @@@ -3035,9 -3042,10 +3036,10 @@@ PHP_METHOD(SoapClient, __getLastRespons if (zend_parse_parameters_none() == FAILURE) { return; } - - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response"), (void **)&tmp) == SUCCESS && - Z_TYPE_PP(tmp) == IS_STRING) { - RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response", sizeof("__last_response")-1)) != NULL) { ++ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response", sizeof("__last_response")-1)) != NULL && ++ Z_TYPE_P(tmp) == IS_STRING) { + RETURN_STR(zend_string_copy(Z_STR_P(tmp))); } RETURN_NULL(); } @@@ -3053,9 -3061,10 +3055,10 @@@ PHP_METHOD(SoapClient, __getLastRequest if (zend_parse_parameters_none() == FAILURE) { return; } - - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_request_headers", sizeof("__last_request_headers"), (void **)&tmp) == SUCCESS && - Z_TYPE_PP(tmp) == IS_STRING) { - RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request_headers", sizeof("__last_request_headers")-1)) != NULL) { ++ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request_headers", sizeof("__last_request_headers")-1)) != NULL && ++ Z_TYPE_P(tmp) == IS_STRING) { + RETURN_STR(zend_string_copy(Z_STR_P(tmp))); } RETURN_NULL(); } @@@ -3072,8 -3081,9 +3075,9 @@@ PHP_METHOD(SoapClient, __getLastRespons return; } - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response_headers", sizeof("__last_response_headers")-1)) != NULL) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_response_headers", sizeof("__last_response_headers"), (void **)&tmp) == SUCCESS && - Z_TYPE_PP(tmp) == IS_STRING) { - RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); ++ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response_headers", sizeof("__last_response_headers")-1)) != NULL && ++ Z_TYPE_P(tmp) == IS_STRING) { + RETURN_STR(zend_string_copy(Z_STR_P(tmp))); } RETURN_NULL(); } @@@ -3129,22 -3138,26 +3133,24 @@@ PHP_METHOD(SoapClient, __setCookie } if (val == NULL) { - if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) != NULL) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS && - Z_TYPE_PP(cookies) == IS_ARRAY) { - zend_hash_del(Z_ARRVAL_PP(cookies), name, name_len+1); ++ if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) != NULL && ++ Z_TYPE_P(cookies) == IS_ARRAY) { + zend_hash_str_del(Z_ARRVAL_P(cookies), name, name_len); } } else { - zval *zcookie; + zval zcookie; - if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) == NULL) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == FAILURE || - Z_TYPE_PP(cookies) != IS_ARRAY) { - zval *tmp_cookies; ++ if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) == NULL || ++ Z_TYPE_P(cookies) != IS_ARRAY) { + zval tmp_cookies; - MAKE_STD_ZVAL(tmp_cookies); - array_init(tmp_cookies); - zend_hash_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), &tmp_cookies, sizeof(zval *), (void **)&cookies); + array_init(&tmp_cookies); + cookies = zend_hash_str_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1, &tmp_cookies); } - ALLOC_INIT_ZVAL(zcookie); - array_init(zcookie); - add_index_stringl(zcookie, 0, val, val_len, 1); - add_assoc_zval_ex(*cookies, name, name_len+1, zcookie); + array_init(&zcookie); + add_index_stringl(&zcookie, 0, val, val_len); + add_assoc_zval_ex(cookies, name, name_len, &zcookie); } } /* }}} */ @@@ -3159,11 -3172,11 +3165,12 @@@ PHP_METHOD(SoapClient, __getCookies return; } - array_init(return_value); - if ((cookies = zend_hash_str_find(Z_OBJPROP_P(getThis()), "_cookies", sizeof("_cookies")-1)) != NULL) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) != FAILURE && - Z_TYPE_PP(cookies) == IS_ARRAY) { - zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_P(*cookies), (copy_ctor_func_t) zval_add_ref, (void *)&tmp, sizeof(zval*)); ++ if ((cookies = zend_hash_str_find(Z_OBJPROP_P(getThis()), "_cookies", sizeof("_cookies")-1)) != NULL && ++ Z_TYPE_P(cookies) == IS_ARRAY) { + ZVAL_ARR(return_value, zend_array_dup(Z_ARRVAL_P(cookies))); + } else { + array_init(return_value); } } /* }}} */ @@@ -4240,8 -4262,9 +4247,9 @@@ static xmlDocPtr serialize_function_cal } } } else { - if ((zstyle = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style")-1)) != NULL) { - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style"), (void **)&zstyle) == SUCCESS && - Z_TYPE_PP(zstyle) == IS_LONG) { - style = Z_LVAL_PP(zstyle); ++ if ((zstyle = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style")-1)) != NULL && ++ Z_TYPE_P(zstyle) == IS_LONG) { + style = Z_LVAL_P(zstyle); } else { style = SOAP_RPC; } @@@ -4262,8 -4285,8 +4270,8 @@@ method = body; } - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "use", sizeof("use"), (void **)&zuse) == SUCCESS && - Z_TYPE_PP(zuse) == IS_LONG && Z_LVAL_PP(zuse) == SOAP_LITERAL) { + if ((zuse = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "use", sizeof("use")-1)) != NULL && - Z_LVAL_P(zuse) == SOAP_LITERAL) { ++ Z_TYPE_P(zuse) == IS_LONG && Z_LVAL_P(zuse) == SOAP_LITERAL) { use = SOAP_LITERAL; } else { use = SOAP_ENCODED; @@@ -4387,13 -4412,14 +4395,14 @@@ static xmlNodePtr serialize_parameter(s if (param_val && Z_TYPE_P(param_val) == IS_OBJECT && Z_OBJCE_P(param_val) == soap_param_class_entry) { - zval **param_name; - zval **param_data; + zval *param_name; + zval *param_data; - if (zend_hash_find(Z_OBJPROP_P(param_val), "param_name", sizeof("param_name"), (void **)&param_name) == SUCCESS && - Z_TYPE_PP(param_name) == IS_STRING && - zend_hash_find(Z_OBJPROP_P(param_val), "param_data", sizeof("param_data"), (void **)&param_data) == SUCCESS) { - param_val = *param_data; - name = Z_STRVAL_PP(param_name); + if ((param_name = zend_hash_str_find(Z_OBJPROP_P(param_val), "param_name", sizeof("param_name")-1)) != NULL && ++ Z_TYPE_P(param_name) == IS_STRING && + (param_data = zend_hash_str_find(Z_OBJPROP_P(param_val), "param_data", sizeof("param_data")-1)) != NULL) { + param_val = param_data; + name = Z_STRVAL_P(param_name); } }
« previous php.cvs (#85157) next »