Skip to content

Commit 0c7cd92

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Fix SoapFault property destruction
2 parents 31e2d2b + e681d93 commit 0c7cd92

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

ext/soap/soap.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,13 @@ static void soap_fault_dtor_properties(zval *obj)
645645
zval_ptr_dtor(Z_FAULT_DETAIL_P(obj));
646646
zval_ptr_dtor(Z_FAULT_NAME_P(obj));
647647
zval_ptr_dtor(Z_FAULT_HEADERFAULT_P(obj));
648+
ZVAL_EMPTY_STRING(Z_FAULT_STRING_P(obj));
649+
ZVAL_NULL(Z_FAULT_CODE_P(obj));
650+
ZVAL_NULL(Z_FAULT_CODENS_P(obj));
651+
ZVAL_NULL(Z_FAULT_ACTOR_P(obj));
652+
ZVAL_NULL(Z_FAULT_DETAIL_P(obj));
653+
ZVAL_NULL(Z_FAULT_NAME_P(obj));
654+
ZVAL_NULL(Z_FAULT_HEADERFAULT_P(obj));
648655
}
649656

650657
/* {{{ SoapFault constructor */
@@ -667,9 +674,6 @@ PHP_METHOD(SoapFault, __construct)
667674
Z_PARAM_ZVAL_OR_NULL(headerfault)
668675
ZEND_PARSE_PARAMETERS_END();
669676

670-
/* Delete previously set properties */
671-
soap_fault_dtor_properties(ZEND_THIS);
672-
673677
if (code_str) {
674678
fault_code = ZSTR_VAL(code_str);
675679
fault_code_len = ZSTR_LEN(code_str);
@@ -688,6 +692,9 @@ PHP_METHOD(SoapFault, __construct)
688692
RETURN_THROWS();
689693
}
690694

695+
/* Delete previously set properties */
696+
soap_fault_dtor_properties(ZEND_THIS);
697+
691698
if (name != NULL && ZSTR_LEN(name) == 0) {
692699
name = NULL;
693700
}

ext/soap/tests/SoapFault/gh14586.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@ soap
66
<?php
77
$sf = new SoapFault(null, "x");
88
$sf->__construct(null, "x");
9+
try {
10+
$sf->__construct("", "");
11+
} catch (ValueError) {}
12+
$sf->__construct(null, "x", headerFault: []);
13+
var_dump($sf->headerfault);
14+
$sf->__construct(null, "x");
15+
var_dump($sf->headerfault);
916
?>
1017
DONE
1118
--EXPECT--
19+
array(0) {
20+
}
21+
NULL
1222
DONE

0 commit comments

Comments
 (0)