From dc00b6cf3f08835d4ad4275123a083bd390983c9 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 5 Sep 2017 17:38:50 +0200 Subject: [PATCH] Fix assertion failure in SoapFault ctor Resetting the IAP on a shared array violates COW. I'm replacing this with code to look up indexes 0 and 1, even though this is not strictly the same. --- ext/soap/soap.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 32cc648a28..3c7e847964 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -891,16 +891,12 @@ PHP_METHOD(SoapFault, SoapFault) fault_code = Z_STRVAL_P(code); fault_code_len = Z_STRLEN_P(code); } else if (Z_TYPE_P(code) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_P(code)) == 2) { - zval *t_ns, *t_code; - - zend_hash_internal_pointer_reset(Z_ARRVAL_P(code)); - t_ns = zend_hash_get_current_data(Z_ARRVAL_P(code)); - zend_hash_move_forward(Z_ARRVAL_P(code)); - t_code = zend_hash_get_current_data(Z_ARRVAL_P(code)); - if (Z_TYPE_P(t_ns) == IS_STRING && Z_TYPE_P(t_code) == IS_STRING) { - fault_code_ns = Z_STRVAL_P(t_ns); - fault_code = Z_STRVAL_P(t_code); - fault_code_len = Z_STRLEN_P(t_code); + zval *t_ns = zend_hash_index_find(Z_ARRVAL_P(code), 0); + zval *t_code = zend_hash_index_find(Z_ARRVAL_P(code), 1); + if (t_ns && t_code && Z_TYPE_P(t_ns) == IS_STRING && Z_TYPE_P(t_code) == IS_STRING) { + fault_code_ns = Z_STRVAL_P(t_ns); + fault_code = Z_STRVAL_P(t_code); + fault_code_len = Z_STRLEN_P(t_code); } else { php_error_docref(NULL, E_WARNING, "Invalid fault code"); return; -- 2.50.1