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: Minor fix in `NEWS` alignment Fix bug #75306: Memleak in SoapClient
This commit is contained in:
@@ -3268,6 +3268,9 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
|
||||
tmp = Z_CLIENT_STREAM_CONTEXT_P(this_ptr);
|
||||
if (Z_TYPE_P(tmp) == IS_RESOURCE) {
|
||||
context = php_stream_context_from_zval(tmp, 0);
|
||||
/* Share a reference with new_context down below.
|
||||
* For new contexts, the reference is only in new_context so that doesn't need extra refcounting. */
|
||||
GC_ADDREF(context->res);
|
||||
}
|
||||
|
||||
tmp = Z_CLIENT_USER_AGENT_P(this_ptr);
|
||||
@@ -3334,7 +3337,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
|
||||
}
|
||||
|
||||
if (context) {
|
||||
php_stream_context_to_zval(context, &new_context);
|
||||
ZVAL_RES(&new_context, context->res);
|
||||
php_libxml_switch_context(&new_context, &orig_context);
|
||||
}
|
||||
|
||||
|
||||
20
ext/soap/tests/bug75306.phpt
Normal file
20
ext/soap/tests/bug75306.phpt
Normal file
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #75306 (Memleak in SoapClient)
|
||||
--EXTENSIONS--
|
||||
soap
|
||||
--FILE--
|
||||
<?php
|
||||
$options = array("cache_wsdl" => WSDL_CACHE_NONE);
|
||||
// Need a warm-up for globals
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$client = new SoapClient("ext/soap/tests/test.wsdl", $options);
|
||||
}
|
||||
$usage = memory_get_usage();
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$client = new SoapClient("ext/soap/tests/test.wsdl", $options);
|
||||
}
|
||||
$usage_delta = memory_get_usage() - $usage;
|
||||
var_dump($usage_delta);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
Reference in New Issue
Block a user