diff --git a/NEWS b/NEWS index 519b0ccaf053..3841fe8f6025 100644 --- a/NEWS +++ b/NEWS @@ -62,6 +62,10 @@ PHP NEWS . Fixed bug GH-23477 (Memory leak on duplicate native Phar manifest entries). (Weilin Du) +- SOAP: + . Fixed WSDL cache corruption when a soap:header defines headerfaults. + (iliaal) + - Standard: . Fixed a segfault when a stream filter callback unsets StreamBucket::$data before re-attaching the bucket. (iliaal) diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index a44fc16f9716..109123139156 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -2066,7 +2066,7 @@ static void sdl_serialize_soap_body(const sdlSoapBindingFunctionBodyPtr body, co sdlSoapBindingFunctionHeaderPtr tmp2; const zend_string *key_inner; - ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(body->headers, key_inner, tmp2) { + ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(tmp->headerfaults, key_inner, tmp2) { sdl_serialize_key(key_inner, out); WSDL_CACHE_PUT_1(tmp2->use, out); if (tmp2->use == SOAP_ENCODED) { diff --git a/ext/soap/tests/headerfault_cache.phpt b/ext/soap/tests/headerfault_cache.phpt new file mode 100644 index 000000000000..5fa7c1ad6eea --- /dev/null +++ b/ext/soap/tests/headerfault_cache.phpt @@ -0,0 +1,36 @@ +--TEST-- +WSDL cache corruption when soap:header has headerfaults +--EXTENSIONS-- +soap +--INI-- +soap.wsdl_cache_enabled=1 +--FILE-- + WSDL_CACHE_DISK]; + +$c1 = new SoapClient(__DIR__ . '/headerfault_cache.wsdl', $options); +var_dump($c1->__getFunctions()); + +$c2 = new SoapClient(__DIR__ . '/headerfault_cache.wsdl', $options); +var_dump($c2->__getFunctions()); + +foreach (glob($dir . '/*') as $f) { + @unlink($f); +} +@rmdir($dir); +echo "ok\n"; +?> +--EXPECT-- +array(1) { + [0]=> + string(32) "string testHeader(string $param)" +} +array(1) { + [0]=> + string(32) "string testHeader(string $param)" +} +ok diff --git a/ext/soap/tests/headerfault_cache.wsdl b/ext/soap/tests/headerfault_cache.wsdl new file mode 100644 index 000000000000..8a844c0b899d --- /dev/null +++ b/ext/soap/tests/headerfault_cache.wsdl @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +