mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3'
* PHP-8.3: ext/soap: Fix memory leaks when calling SoapFault::__construct() twice
This commit is contained in:
commit
a888c4f0ff
2 changed files with 26 additions and 0 deletions
|
@ -627,6 +627,17 @@ PHP_METHOD(SoapHeader, __construct)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
static void soap_fault_dtor_properties(zval *obj)
|
||||
{
|
||||
zval_ptr_dtor(Z_FAULT_STRING_P(obj));
|
||||
zval_ptr_dtor(Z_FAULT_CODE_P(obj));
|
||||
zval_ptr_dtor(Z_FAULT_CODENS_P(obj));
|
||||
zval_ptr_dtor(Z_FAULT_ACTOR_P(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));
|
||||
}
|
||||
|
||||
/* {{{ SoapFault constructor */
|
||||
PHP_METHOD(SoapFault, __construct)
|
||||
{
|
||||
|
@ -646,6 +657,9 @@ 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);
|
||||
|
|
12
ext/soap/tests/SoapFault/gh14586.phpt
Normal file
12
ext/soap/tests/SoapFault/gh14586.phpt
Normal file
|
@ -0,0 +1,12 @@
|
|||
--TEST--
|
||||
GH-14586: SoapFault::__construct() leaks memory if called twice
|
||||
--EXTENSIONS--
|
||||
soap
|
||||
--FILE--
|
||||
<?php
|
||||
$sf = new SoapFault(null, "x");
|
||||
$sf->__construct(null, "x");
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
Loading…
Add table
Add a link
Reference in a new issue