[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
| From: | Daniel Scherzer | Date: | Sat, 03 Oct 2026 01:31:37 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141904@lists.php.net to get a copy of this message | ||
Author: Daniel Scherzer (DanielEScherzer)
Date: 2026-10-02T18:29:47-07:00
Commit: https://github.com/php/php-src/commit/957aac2bc3c3edba12d27e81e9cdaeeb273727b4
Raw diff: https://github.com/php/php-src/commit/957aac2bc3c3edba12d27e81e9cdaeeb273727b4.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
ext/soap: fix leak when
load_wsdl_ex() fails to load (#24066)
Changed paths:
A ext/soap/tests/load_wsdl_ex-failure-leak.phpt
A ext/soap/tests/load_wsdl_ex-failure-leak.wsdl
M NEWS
M ext/soap/php_sdl.c
Diff:
diff --git a/NEWS b/NEWS
index 3974e4808afa..f14d47d2aca5 100644
--- a/NEWS
+++ b/NEWS
@@ -185,6 +185,7 @@ PHP NEWS
- SOAP:
. Fixed bug GH-22895 (Heap use-after-free while encoding a Traversable with
an illegal key). (David Carlier)
+ . Fixed memory leak when load_wsdl_ex() failed to load. (DanielEScherzer)
- SQLite:
. Fixed a crash when SQLite3::close() is called from a userland callback.
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 566b8dc1e503..7a1ff08752e2 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -369,7 +369,12 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, bool
include
xmlAttrPtr tmp = get_attribute(trav->properties, "location");
if (tmp) {
xmlChar *uri = schema_location_construct_uri(tmp);
- load_wsdl_ex(this_ptr, (char*)uri, ctx, true);
+ zend_try {
+ load_wsdl_ex(this_ptr, (char*)uri, ctx, true);
+ } zend_catch {
+ xmlFree(uri);
+ zend_bailout();
+ } zend_end_try();
xmlFree(uri);
}
diff --git a/ext/soap/tests/load_wsdl_ex-failure-leak.phpt
b/ext/soap/tests/load_wsdl_ex-failure-leak.phpt
new file mode 100644
index 000000000000..b71c6183a513
--- /dev/null
+++ b/ext/soap/tests/load_wsdl_ex-failure-leak.phpt
@@ -0,0 +1,18 @@
+--TEST--
+load_wsdl_ex() leaks the import location if imported WSDL fails to load
+--EXTENSIONS--
+soap
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+
+try {
+ $client = new SoapClient(__DIR__ . '/load_wsdl_ex-failure-leak.wsdl');
+} catch (SoapFault $e) {
+ echo get_class($e) . ': ' . $e->getMessage() . "\n";
+}
+
+?>
+--EXPECTF--
+SoapFault: SOAP-ERROR: Parsing WSDL: Couldn't load from
'%sload_wsdl_ex-failure-leak-missing.wsdl' : %s
diff --git a/ext/soap/tests/load_wsdl_ex-failure-leak.wsdl
b/ext/soap/tests/load_wsdl_ex-failure-leak.wsdl
new file mode 100644
index 000000000000..b9065bbeb1d6
--- /dev/null
+++ b/ext/soap/tests/load_wsdl_ex-failure-leak.wsdl
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<definitions
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+>
+ <import location="load_wsdl_ex-failure-leak-missing.wsdl"/>
+</definitions>