mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: ext/soap: Fix memory leaks when calling SoapFault::__construct() twice
This commit is contained in:
1
NEWS
1
NEWS
@@ -58,6 +58,7 @@ PHP NEWS
|
||||
. Fixed bug #69280 (SoapClient classmap doesn't support fully qualified class
|
||||
name). (nielsdos)
|
||||
. Fixed bug #76232 (SoapClient Cookie Header Semicolon). (nielsdos)
|
||||
. Fixed memory leaks when calling SoapFault::__construct() twice. (Girgias)
|
||||
|
||||
- Sodium:
|
||||
. Fix memory leaks in ext/sodium on failure of some functions. (nielsdos)
|
||||
|
||||
@@ -520,6 +520,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)
|
||||
{
|
||||
@@ -539,6 +550,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
|
||||
Reference in New Issue
Block a user