|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79191 Error in SoapClient creation leads to DOMDocument::save() not working
Submitted: 2020-01-29 13:57 UTC Modified: 2020-02-03 23:15 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: Assigned: cmb (profile)
Status: Closed Package: *XML functions
PHP Version: 7.4.2 OS: Irrelevant
Private report: No CVE-ID: None
 [2020-01-29 13:57 UTC]
When the creation of a SoapClient object fails then DOMDocument::save() no longer works. This issue came up in the context of PHPUnit:


A minimal and self-contained script that reproduces the issue is provided below.

Test script:
try {
  new \SoapClient('does-not-exist.wsdl');
} catch (Throwable $t) {

$dom = new DOMDocument;

$dom->loadxml('<?xml version="1.0" ?><root />');


Expected result:
int(number of bytes written)

Actual result:


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-01-29 14:13 UTC]
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-30 00:52 UTC]
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.

 [2020-01-30 11:24 UTC]
The following pull request has been associated:

Patch Name: Fix #79191: Error in SoapClient ctor disables DOMDocument::save()
On GitHub:
 [2020-01-30 11:26 UTC]
-Status: Open +Status: Verified
 [2020-02-03 22:29 UTC]
-Package: DOM XML related +Package: *XML functions
 [2020-02-03 23:14 UTC]
Automatic comment on behalf of
Log: Fix #79191: Error in SoapClient ctor disables DOMDocument::save()
 [2020-02-03 23:14 UTC]
-Status: Verified +Status: Closed
 [2020-02-03 23:15 UTC]
-Assigned To: +Assigned To: cmb
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 22:01:28 2024 UTC