Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions ext/soap/soap.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,13 @@ static void soap_fault_dtor_properties(zval *obj)
zval_ptr_dtor(Z_FAULT_DETAIL_P(obj));
zval_ptr_dtor(Z_FAULT_NAME_P(obj));
zval_ptr_dtor(Z_FAULT_HEADERFAULT_P(obj));
ZVAL_EMPTY_STRING(Z_FAULT_STRING_P(obj));
ZVAL_NULL(Z_FAULT_CODE_P(obj));
ZVAL_NULL(Z_FAULT_CODENS_P(obj));
ZVAL_NULL(Z_FAULT_ACTOR_P(obj));
ZVAL_NULL(Z_FAULT_DETAIL_P(obj));
ZVAL_NULL(Z_FAULT_NAME_P(obj));
ZVAL_NULL(Z_FAULT_HEADERFAULT_P(obj));
}

/* {{{ SoapFault constructor */
Expand All @@ -550,9 +557,6 @@ PHP_METHOD(SoapFault, __construct)
Z_PARAM_ZVAL_OR_NULL(headerfault)
ZEND_PARSE_PARAMETERS_END();

/* Delete previously set properties */
soap_fault_dtor_properties(ZEND_THIS);

if (code_str) {
fault_code = ZSTR_VAL(code_str);
fault_code_len = ZSTR_LEN(code_str);
Expand All @@ -571,6 +575,9 @@ PHP_METHOD(SoapFault, __construct)
RETURN_THROWS();
}

/* Delete previously set properties */
soap_fault_dtor_properties(ZEND_THIS);

if (name != NULL && name_len == 0) {
name = NULL;
}
Expand Down
10 changes: 10 additions & 0 deletions ext/soap/tests/SoapFault/gh14586.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ soap
<?php
$sf = new SoapFault(null, "x");
$sf->__construct(null, "x");
try {
$sf->__construct("", "");
} catch (ValueError) {}
$sf->__construct(null, "x", headerFault: []);
var_dump($sf->headerfault);
$sf->__construct(null, "x");
var_dump($sf->headerfault);
?>
DONE
--EXPECT--
array(0) {
}
NULL
DONE
Loading