From e219ec144ef6682b71e135fd18654ee1bb4676b4 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 7 Jan 2019 12:28:51 +0100 Subject: Implement typed properties RFC: https://wiki.php.net/rfc/typed_properties_v2 This is a squash of PR #3734, which is a squash of PR #3313. Co-authored-by: Bob Weinand Co-authored-by: Joe Watkins Co-authored-by: Dmitry Stogov --- ext/xmlrpc/xmlrpc-epi-php.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'ext/xmlrpc/xmlrpc-epi-php.c') diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 737a3f84a5..937f7b1b0f 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -764,11 +764,9 @@ void decode_request_worker(char *xml_in, int xml_in_len, char *encoding_in, zval if (method_name_out) { method_name = XMLRPC_RequestGetMethodName(response); if (method_name) { - zval_ptr_dtor(method_name_out); - ZVAL_STRING(method_name_out, method_name); + ZEND_TRY_ASSIGN_STRING(method_name_out, method_name); } else { - zval_ptr_dtor(retval); - ZVAL_NULL(retval); + ZEND_TRY_ASSIGN_NULL(retval); } } } @@ -787,7 +785,7 @@ PHP_FUNCTION(xmlrpc_decode_request) zval *method; size_t xml_len, encoding_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz/|s", &xml, &xml_len, &method, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz|s", &xml, &xml_len, &method, &encoding, &encoding_len) == FAILURE) { return; } @@ -1389,15 +1387,19 @@ PHP_FUNCTION(xmlrpc_set_type) size_t type_len; XMLRPC_VALUE_TYPE vtype; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/s", &arg, &type, &type_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs", &arg, &type, &type_len) == FAILURE) { return; } vtype = xmlrpc_str_as_type(type); if (vtype != xmlrpc_none) { - if (set_zval_xmlrpc_type(arg, vtype) == SUCCESS) { + zval tmp; + ZVAL_COPY(&tmp, Z_REFVAL_P(arg)); + if (set_zval_xmlrpc_type(&tmp, vtype) == SUCCESS) { + ZEND_TRY_ASSIGN_VALUE(arg, &tmp); RETURN_TRUE; } + Z_TRY_DELREF(tmp); } else { zend_error(E_WARNING,"invalid type '%s' passed to xmlrpc_set_type()", type); } -- cgit v1.2.1