Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,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)

- Sockets:
. Fixed socket_select() silently truncating sets larger than FD_SETSIZE on
Expand Down
7 changes: 6 additions & 1 deletion ext/soap/php_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,12 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int 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, 1);
zend_try {
load_wsdl_ex(this_ptr, (char*)uri, ctx, 1);
} zend_catch {
xmlFree(uri);
zend_bailout();
} zend_end_try();
xmlFree(uri);
}

Expand Down
18 changes: 18 additions & 0 deletions ext/soap/tests/load_wsdl_ex-failure-leak.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
Comment thread
DanielEScherzer marked this conversation as resolved.
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
7 changes: 7 additions & 0 deletions ext/soap/tests/load_wsdl_ex-failure-leak.wsdl
Original file line number Diff line number Diff line change
@@ -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>
Loading