Bug #79191 [Ver->Csd]: Error in SoapClient creation leads to DOMDocument::save() not working
| From: | cmb@php.net | Date: | Mon, 03 Feb 2020 23:14:16 +0000 |
| Subject: | Bug #79191 [Ver->Csd]: Error in SoapClient creation leads to DOMDocument::save() not working | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225339@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79191&edit=1
ID: 79191
Updated by: cmb@php.net
Reported by: sebastian@php.net
Summary: Error in SoapClient creation leads to
DOMDocument::save() not working
-Status: Verified
+Status: Closed
Type: Bug
Package: *XML functions
Operating System: Irrelevant
PHP Version: 7.4.2
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fe1bfb78d65d28dd151da417477a0cee51de8afb
Log: Fix #79191: Error in SoapClient ctor disables DOMDocument::save()
Previous Comments:
------------------------------------------------------------------------
[2020-01-30 11:24:58] cmb@php.net
The following pull request has been associated:
Patch Name: Fix #79191: Error in SoapClient ctor disables DOMDocument::save()
On GitHub: https://github.com/php/php-src/pull/5133
Patch: https://github.com/php/php-src/pull/5133.patch
------------------------------------------------------------------------
[2020-01-30 00:52:29] daverandom@php.net
This is caused by the SoapClient constructor invoking zend_bailout() when any exception other than a
SoapFault is encountered [1]. This results in unclean_shutdown being set, which prevents the write
operation taking place [2].
The logic in SoapClient is clearly wrong here, I suspect it shouldn't be directly responsible
for invoking zend_bailout() at all but I'm not 100% certain of that.
[1] https://github.com/php/php-src/blob/acc616c455c007857e6aeb006e3e9aa63565c461/ext/soap/soap.c#L106-L128
[2] https://github.com/php/php-src/blob/acc616c455c007857e6aeb006e3e9aa63565c461/ext/libxml/libxml.c#L385-L387
------------------------------------------------------------------------
[2020-01-29 14:13:19] sebastian@php.net
Please note that DOMDocument::saveXml() works, so the document is correctly stored in the
DOMDocument object. It is "just" that DOMDocument::save() no longer works after an error
in SoapClient occurred.
------------------------------------------------------------------------
[2020-01-29 13:57:55] sebastian@php.net
Description:
------------
When the creation of a SoapClient object fails then DOMDocument::save() no longer works. This issue
came up in the context of PHPUnit:
* https://github.com/sebastianbergmann/php-code-coverage/issues/692
* https://github.com/sebastianbergmann/php-code-coverage/pull/721
* https://github.com/sebastianbergmann/php-code-coverage/issues/692#issuecomment-579761041
A minimal and self-contained script that reproduces the issue is provided below.
Test script:
---------------
<?php
try {
new \SoapClient('does-not-exist.wsdl');
} catch (Throwable $t) {
}
$dom = new DOMDocument;
$dom->loadxml('<?xml version="1.0" ?><root />');
var_dump($dom->save('/tmp/test.xml'));
Expected result:
----------------
int(number of bytes written)
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79191&edit=1