com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/soap/php _encoding.c ext/soap/php_http.c ext/soap/soap.c
| From: | Dmitry Stogov | Date: | Tue, 03 Mar 2015 06:52:21 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.4' into PHP-5.5: 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-85155@lists.php.net to get a copy of this message | ||
Commit: 035d80523f3ec1c5f1c071a7b2e71cbe3ef43461
Author: Dmitry Stogov <dmitry@zend.com> Tue, 3 Mar 2015 09:52:21 +0300
Parents: 34f09b62408759e9d8754ccdd790c6586507a4d2 0c136a2abd49298b66acb0cad504f0f972f5bfe8
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=035d80523f3ec1c5f1c071a7b2e71cbe3ef43461
Log:
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
Added type checks
Conflicts:
ext/soap/soap.c
Changed paths:
MM ext/soap/php_encoding.c
MM ext/soap/php_http.c
MM ext/soap/soap.c
diff --cc ext/soap/soap.c index ffa4007,9ec6347..58d8e3a --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@@ -2599,14 -2594,9 +2599,14 @@@ static int do_request(zval *this_ptr, x } ret = FALSE; } else if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS && - Z_TYPE_PP(trace) == IS_LONG && Z_LVAL_PP(trace) > 0) { + (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); } + zval_ptr_dtor(¶ms[4]); + zval_ptr_dtor(¶ms[3]); + zval_ptr_dtor(¶ms[2]); + zval_ptr_dtor(¶ms[1]); + zval_ptr_dtor(¶ms[0]); xmlFree(buf); if (ret && zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) { return FALSE; @@@ -2698,121 -2688,116 +2698,121 @@@ static void do_soap_call(zval* this_ptr SOAP_GLOBAL(features) = 0; } - if (sdl != NULL) { - fn = get_function(sdl, function); - if (fn != NULL) { - sdlBindingPtr binding = fn->binding; - int one_way = 0; - - if (fn->responseName == NULL && - fn->responseParameters == NULL && - soap_headers == NULL) { - one_way = 1; - } - - if (location == NULL) { - location = binding->location; - } - if (binding->bindingType == BINDING_SOAP) { - sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes; - request = serialize_function_call(this_ptr, fn, NULL, fnb->input.ns, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); - ret = do_request(this_ptr, request, location, fnb->soapAction, soap_version, one_way, &response TSRMLS_CC); - } else { - request = serialize_function_call(this_ptr, fn, NULL, sdl->target_ns, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); - ret = do_request(this_ptr, request, location, NULL, soap_version, one_way, &response TSRMLS_CC); - } - - xmlFreeDoc(request); - - if (ret && Z_TYPE(response) == IS_STRING) { - encode_reset_ns(); - ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), fn, NULL, return_value, output_headers TSRMLS_CC); - encode_finish(); - } + zend_try { + if (sdl != NULL) { + fn = get_function(sdl, function); + if (fn != NULL) { + sdlBindingPtr binding = fn->binding; + int one_way = 0; + + if (fn->responseName == NULL && + fn->responseParameters == NULL && + soap_headers == NULL) { + one_way = 1; + } - zval_dtor(&response); + if (location == NULL) { + location = binding->location; + } + if (binding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes; + request = serialize_function_call(this_ptr, fn, NULL, fnb->input.ns, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); + ret = do_request(this_ptr, request, location, fnb->soapAction, soap_version, one_way, &response TSRMLS_CC); + } else { + request = serialize_function_call(this_ptr, fn, NULL, sdl->target_ns, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); + ret = do_request(this_ptr, request, location, NULL, soap_version, one_way, &response TSRMLS_CC); + } + + xmlFreeDoc(request); + + if (ret && Z_TYPE(response) == IS_STRING) { + encode_reset_ns(); + ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), fn, NULL, return_value, output_headers TSRMLS_CC); + encode_finish(); + } - } else { - smart_str error = {0}; - smart_str_appends(&error,"Function (\""); - smart_str_appends(&error,function); - smart_str_appends(&error,"\") is not a valid method for this service"); - smart_str_0(&error); - add_soap_fault(this_ptr, "Client", error.c, NULL, NULL TSRMLS_CC); - smart_str_free(&error); - } - } else { - zval **uri; - smart_str action = {0}; + zval_dtor(&response); - 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); - } else if (location == NULL) { - add_soap_fault(this_ptr, "Client", "Error could not find \"location\" property", NULL, NULL TSRMLS_CC); - } else { - if (call_uri == NULL) { - call_uri = Z_STRVAL_PP(uri); + } else { + smart_str error = {0}; + smart_str_appends(&error,"Function (\""); + smart_str_appends(&error,function); + smart_str_appends(&error,"\") is not a valid method for this service"); + smart_str_0(&error); + add_soap_fault(this_ptr, "Client", error.c, NULL, NULL TSRMLS_CC); + smart_str_free(&error); } - request = serialize_function_call(this_ptr, NULL, function, call_uri, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); + } else { + zval **uri; + smart_str action = {0}; - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri"), (void *)&uri) == FAILURE) { - if (soap_action == NULL) { - smart_str_appends(&action, call_uri); - smart_str_appendc(&action, '#'); - smart_str_appends(&action, function); ++ 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); + } else if (location == NULL) { + add_soap_fault(this_ptr, "Client", "Error could not find \"location\" property", NULL, NULL TSRMLS_CC); } else { - smart_str_appends(&action, soap_action); - } - smart_str_0(&action); + if (call_uri == NULL) { + call_uri = Z_STRVAL_PP(uri); + } + request = serialize_function_call(this_ptr, NULL, function, call_uri, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); + + if (soap_action == NULL) { + smart_str_appends(&action, call_uri); + smart_str_appendc(&action, '#'); + smart_str_appends(&action, function); + } else { + smart_str_appends(&action, soap_action); + } + smart_str_0(&action); - ret = do_request(this_ptr, request, location, action.c, soap_version, 0, &response TSRMLS_CC); + ret = do_request(this_ptr, request, location, action.c, soap_version, 0, &response TSRMLS_CC); - smart_str_free(&action); - xmlFreeDoc(request); + smart_str_free(&action); + xmlFreeDoc(request); - if (ret && Z_TYPE(response) == IS_STRING) { - encode_reset_ns(); - ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), NULL, function, return_value, output_headers TSRMLS_CC); - encode_finish(); - } + if (ret && Z_TYPE(response) == IS_STRING) { + encode_reset_ns(); + ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), NULL, function, return_value, output_headers TSRMLS_CC); + encode_finish(); + } - zval_dtor(&response); - } - } + zval_dtor(&response); + } + } - if (!ret) { - zval** fault; - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) { - *return_value = **fault; - zval_copy_ctor(return_value); + if (!ret) { + zval** fault; + if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) { + *return_value = **fault; + zval_copy_ctor(return_value); + } else { + *return_value = *add_soap_fault(this_ptr, "Client", "Unknown Error", NULL, NULL TSRMLS_CC); + zval_copy_ctor(return_value); + } } else { - *return_value = *add_soap_fault(this_ptr, "Client", "Unknown Error", NULL, NULL TSRMLS_CC); - zval_copy_ctor(return_value); - } - } else { - zval** fault; - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) { - *return_value = **fault; - zval_copy_ctor(return_value); + zval** fault; + if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) { + *return_value = **fault; + zval_copy_ctor(return_value); + } } - } - if (!EG(exception) && - Z_TYPE_P(return_value) == IS_OBJECT && - instanceof_function(Z_OBJCE_P(return_value), soap_fault_class_entry TSRMLS_CC) && - (zend_hash_find(Z_OBJPROP_P(this_ptr), "_exceptions", sizeof("_exceptions"), (void **) &tmp) != SUCCESS || - Z_TYPE_PP(tmp) != IS_BOOL || Z_LVAL_PP(tmp) != 0)) { - zval *exception; + if (!EG(exception) && + Z_TYPE_P(return_value) == IS_OBJECT && + instanceof_function(Z_OBJCE_P(return_value), soap_fault_class_entry TSRMLS_CC) && + (zend_hash_find(Z_OBJPROP_P(this_ptr), "_exceptions", sizeof("_exceptions"), (void **) &tmp) != SUCCESS || + Z_TYPE_PP(tmp) != IS_BOOL || Z_LVAL_PP(tmp) != 0)) { + zval *exception; - MAKE_STD_ZVAL(exception); - MAKE_COPY_ZVAL(&return_value, exception); - zend_throw_exception_object(exception TSRMLS_CC); - } + MAKE_STD_ZVAL(exception); + MAKE_COPY_ZVAL(&return_value, exception); + zend_throw_exception_object(exception TSRMLS_CC); + } + } zend_catch { + _bailout = 1; + } zend_end_try(); + if (SOAP_GLOBAL(encoding) != NULL) { xmlCharEncCloseFunc(SOAP_GLOBAL(encoding)); }
diff --cc ext/soap/soap.c index ffa4007,9ec6347..58d8e3a --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@@ -2599,14 -2594,9 +2599,14 @@@ static int do_request(zval *this_ptr, x } ret = FALSE; } else if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS && - Z_TYPE_PP(trace) == IS_LONG && Z_LVAL_PP(trace) > 0) { + (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); } + zval_ptr_dtor(¶ms[4]); + zval_ptr_dtor(¶ms[3]); + zval_ptr_dtor(¶ms[2]); + zval_ptr_dtor(¶ms[1]); + zval_ptr_dtor(¶ms[0]); xmlFree(buf); if (ret && zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) { return FALSE; @@@ -2698,121 -2688,116 +2698,121 @@@ static void do_soap_call(zval* this_ptr SOAP_GLOBAL(features) = 0; } - if (sdl != NULL) { - fn = get_function(sdl, function); - if (fn != NULL) { - sdlBindingPtr binding = fn->binding; - int one_way = 0; - - if (fn->responseName == NULL && - fn->responseParameters == NULL && - soap_headers == NULL) { - one_way = 1; - } - - if (location == NULL) { - location = binding->location; - } - if (binding->bindingType == BINDING_SOAP) { - sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes; - request = serialize_function_call(this_ptr, fn, NULL, fnb->input.ns, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); - ret = do_request(this_ptr, request, location, fnb->soapAction, soap_version, one_way, &response TSRMLS_CC); - } else { - request = serialize_function_call(this_ptr, fn, NULL, sdl->target_ns, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); - ret = do_request(this_ptr, request, location, NULL, soap_version, one_way, &response TSRMLS_CC); - } - - xmlFreeDoc(request); - - if (ret && Z_TYPE(response) == IS_STRING) { - encode_reset_ns(); - ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), fn, NULL, return_value, output_headers TSRMLS_CC); - encode_finish(); - } + zend_try { + if (sdl != NULL) { + fn = get_function(sdl, function); + if (fn != NULL) { + sdlBindingPtr binding = fn->binding; + int one_way = 0; + + if (fn->responseName == NULL && + fn->responseParameters == NULL && + soap_headers == NULL) { + one_way = 1; + } - zval_dtor(&response); + if (location == NULL) { + location = binding->location; + } + if (binding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes; + request = serialize_function_call(this_ptr, fn, NULL, fnb->input.ns, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); + ret = do_request(this_ptr, request, location, fnb->soapAction, soap_version, one_way, &response TSRMLS_CC); + } else { + request = serialize_function_call(this_ptr, fn, NULL, sdl->target_ns, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); + ret = do_request(this_ptr, request, location, NULL, soap_version, one_way, &response TSRMLS_CC); + } + + xmlFreeDoc(request); + + if (ret && Z_TYPE(response) == IS_STRING) { + encode_reset_ns(); + ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), fn, NULL, return_value, output_headers TSRMLS_CC); + encode_finish(); + } - } else { - smart_str error = {0}; - smart_str_appends(&error,"Function (\""); - smart_str_appends(&error,function); - smart_str_appends(&error,"\") is not a valid method for this service"); - smart_str_0(&error); - add_soap_fault(this_ptr, "Client", error.c, NULL, NULL TSRMLS_CC); - smart_str_free(&error); - } - } else { - zval **uri; - smart_str action = {0}; + zval_dtor(&response); - 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); - } else if (location == NULL) { - add_soap_fault(this_ptr, "Client", "Error could not find \"location\" property", NULL, NULL TSRMLS_CC); - } else { - if (call_uri == NULL) { - call_uri = Z_STRVAL_PP(uri); + } else { + smart_str error = {0}; + smart_str_appends(&error,"Function (\""); + smart_str_appends(&error,function); + smart_str_appends(&error,"\") is not a valid method for this service"); + smart_str_0(&error); + add_soap_fault(this_ptr, "Client", error.c, NULL, NULL TSRMLS_CC); + smart_str_free(&error); } - request = serialize_function_call(this_ptr, NULL, function, call_uri, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); + } else { + zval **uri; + smart_str action = {0}; - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri"), (void *)&uri) == FAILURE) { - if (soap_action == NULL) { - smart_str_appends(&action, call_uri); - smart_str_appendc(&action, '#'); - smart_str_appends(&action, function); ++ 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); + } else if (location == NULL) { + add_soap_fault(this_ptr, "Client", "Error could not find \"location\" property", NULL, NULL TSRMLS_CC); } else { - smart_str_appends(&action, soap_action); - } - smart_str_0(&action); + if (call_uri == NULL) { + call_uri = Z_STRVAL_PP(uri); + } + request = serialize_function_call(this_ptr, NULL, function, call_uri, real_args, arg_count, soap_version, soap_headers TSRMLS_CC); + + if (soap_action == NULL) { + smart_str_appends(&action, call_uri); + smart_str_appendc(&action, '#'); + smart_str_appends(&action, function); + } else { + smart_str_appends(&action, soap_action); + } + smart_str_0(&action); - ret = do_request(this_ptr, request, location, action.c, soap_version, 0, &response TSRMLS_CC); + ret = do_request(this_ptr, request, location, action.c, soap_version, 0, &response TSRMLS_CC); - smart_str_free(&action); - xmlFreeDoc(request); + smart_str_free(&action); + xmlFreeDoc(request); - if (ret && Z_TYPE(response) == IS_STRING) { - encode_reset_ns(); - ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), NULL, function, return_value, output_headers TSRMLS_CC); - encode_finish(); - } + if (ret && Z_TYPE(response) == IS_STRING) { + encode_reset_ns(); + ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), NULL, function, return_value, output_headers TSRMLS_CC); + encode_finish(); + } - zval_dtor(&response); - } - } + zval_dtor(&response); + } + } - if (!ret) { - zval** fault; - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) { - *return_value = **fault; - zval_copy_ctor(return_value); + if (!ret) { + zval** fault; + if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) { + *return_value = **fault; + zval_copy_ctor(return_value); + } else { + *return_value = *add_soap_fault(this_ptr, "Client", "Unknown Error", NULL, NULL TSRMLS_CC); + zval_copy_ctor(return_value); + } } else { - *return_value = *add_soap_fault(this_ptr, "Client", "Unknown Error", NULL, NULL TSRMLS_CC); - zval_copy_ctor(return_value); - } - } else { - zval** fault; - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) { - *return_value = **fault; - zval_copy_ctor(return_value); + zval** fault; + if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) { + *return_value = **fault; + zval_copy_ctor(return_value); + } } - } - if (!EG(exception) && - Z_TYPE_P(return_value) == IS_OBJECT && - instanceof_function(Z_OBJCE_P(return_value), soap_fault_class_entry TSRMLS_CC) && - (zend_hash_find(Z_OBJPROP_P(this_ptr), "_exceptions", sizeof("_exceptions"), (void **) &tmp) != SUCCESS || - Z_TYPE_PP(tmp) != IS_BOOL || Z_LVAL_PP(tmp) != 0)) { - zval *exception; + if (!EG(exception) && + Z_TYPE_P(return_value) == IS_OBJECT && + instanceof_function(Z_OBJCE_P(return_value), soap_fault_class_entry TSRMLS_CC) && + (zend_hash_find(Z_OBJPROP_P(this_ptr), "_exceptions", sizeof("_exceptions"), (void **) &tmp) != SUCCESS || + Z_TYPE_PP(tmp) != IS_BOOL || Z_LVAL_PP(tmp) != 0)) { + zval *exception; - MAKE_STD_ZVAL(exception); - MAKE_COPY_ZVAL(&return_value, exception); - zend_throw_exception_object(exception TSRMLS_CC); - } + MAKE_STD_ZVAL(exception); + MAKE_COPY_ZVAL(&return_value, exception); + zend_throw_exception_object(exception TSRMLS_CC); + } + } zend_catch { + _bailout = 1; + } zend_end_try(); + if (SOAP_GLOBAL(encoding) != NULL) { xmlCharEncCloseFunc(SOAP_GLOBAL(encoding)); }