1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3'

* PHP-8.3:
  Fix SoapFault property destruction
This commit is contained in:
Niels Dossche
2024-08-05 22:04:10 +02:00
2 changed files with 20 additions and 3 deletions

View File

@@ -645,6 +645,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 */
@@ -667,9 +674,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);
@@ -688,6 +692,9 @@ PHP_METHOD(SoapFault, __construct)
RETURN_THROWS();
}
/* Delete previously set properties */
soap_fault_dtor_properties(ZEND_THIS);
if (name != NULL && ZSTR_LEN(name) == 0) {
name = NULL;
}

View File

@@ -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