Skip to content

Commit 61265c2

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix phpGH-19784: SoapServer memory leak
2 parents ef97a28 + d30dd1b commit 61265c2

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ PHP NEWS
1717
. Fixed bug GH-19669 (assertion failure in zend_jit_trace_type_to_info_ex).
1818
(Arnaud)
1919

20+
- Soap:
21+
. Fixed bug GH-19784 (SoapServer memory leak). (nielsdos)
22+
2023
- Standard:
2124
. Fixed bug GH-12265 (Cloning an object breaks serialization recursion).
2225
(nielsdos)

ext/soap/soap.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,13 @@ PHP_METHOD(SoapServer, __construct)
10021002
service->soap_functions.ft = zend_new_array(0);
10031003

10041004
if (wsdl) {
1005-
service->sdl = get_sdl(ZEND_THIS, ZSTR_VAL(wsdl), cache_wsdl);
1005+
zend_try {
1006+
service->sdl = get_sdl(ZEND_THIS, ZSTR_VAL(wsdl), cache_wsdl);
1007+
} zend_catch {
1008+
xmlCharEncCloseFunc(service->encoding);
1009+
service->encoding = NULL;
1010+
zend_bailout();
1011+
} zend_end_try();
10061012
if (service->uri == NULL) {
10071013
if (service->sdl->target_ns) {
10081014
service->uri = estrdup(service->sdl->target_ns);

ext/soap/tests/bugs/gh19784.phpt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
GH-19784 (SoapServer memory leak)
3+
--EXTENSIONS--
4+
soap
5+
--FILE--
6+
<?php
7+
$v_5256 = 'zpHOks6TzpTOlc6WzpfOmM6ZzprOm86czp3Ons6fzqDOoc6jzqTOpc6mzqfOqM6p';
8+
$v_5257 = base64_decode($v_5256,);
9+
$v_5238 = array('encoding' => $v_5257);
10+
new SoapServer('foobarbaz',$v_5238,);
11+
?>
12+
--EXPECTF--
13+
<?xml version="1.0" encoding="UTF-8"?>
14+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>%s</faultcode><faultstring>%a

0 commit comments

Comments
 (0)