Bug #72136 [Com]: Instancing SoapClient causing SimpleXMLElement::asXML method doesn't work

From: Date: Fri, 12 Feb 2021 17:59:28 +0000
Subject: Bug #72136 [Com]: Instancing SoapClient causing SimpleXMLElement::asXML method doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232105@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72136&edit=1 ID: 72136 Comment by: gudang dot 673 at gmail dot cpm Reported by: michal at lipek dot net Summary: Instancing SoapClient causing SimpleXMLElement::asXML method doesn't work Status: Open Type: Bug Package: SimpleXML related Operating System: Linux, Windows PHP Version: 7.0.6 Block user comment: N Private report: N New Comment: Almost five years and no fix yet? Seriously? Previous Comments: ------------------------------------------------------------------------ [2017-03-31 12:14:07] kondratev dot v at gmail dot com Good afternoon. Faced the same problem. I get false in the save method of the DOMDocument class. try { $test = @new SoapClient($url, $options); } catch (SoapFault $e) { } //***** $dom = new DOMDocument('1.0', "UTF-8"); //... $result = $dom->save($fileName); $result === false //**** it works: if ($result === false) { file_put_contents($fileName, $dom->saveXML()); } ------------------------------------------------------------------------ [2016-05-02 07:04:41] michal at lipek dot net Description: ------------ Creating instance of \SoapClient with incorrect path to WSDL file causing incorrect work of SimpleXMLElement::asXML method, in completely different object. I ran script below in PHP: 5.5 (Debian), 5.6 (Windows) and 7.0.6 (Windows) and 7.0.5 (CentOS). I got errors only in PHP 7 on Windows and Linux. I've made one change in php.ini - I was activated php_soap extension. Test script: --------------- <?php libxml_use_internal_errors(true); try { $a = new \SoapClient('fake/wsdl'); } catch (\SoapFault $ex) { } $source = simplexml_load_string("<xml></xml>"); var_dump($source->asXML('example.xml')); // should be true var_dump(libxml_get_errors()); // should be one error, but there are 2 Expected result: ---------------- bool(true) array(1) { [0]=> object(LibXMLError)#3 (6) { ["level"]=> int(1) ["code"]=> int(1549) ["column"]=> int(0) ["message"]=> string(43) "failed to load external entity "fake/wsdl" " ["file"]=> string(0) "" ["line"]=> int(0) } } PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'fake/wsdl' : failed to load external entity "fake/wsdl" in C:\a.php on line 6 Actual result: -------------- bool(false) array(2) { [0]=> object(LibXMLError)#3 (6) { ["level"]=> int(1) ["code"]=> int(1549) ["column"]=> int(0) ["message"]=> string(43) "failed to load external entity "fake/wsdl" " ["file"]=> string(0) "" ["line"]=> int(0) } [1]=> object(LibXMLError)#4 (6) { ["level"]=> int(2) ["code"]=> int(1545) ["column"]=> int(0) ["message"]=> string(11) "flush error" ["file"]=> string(0) "" ["line"]=> int(0) } } PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'fake/wsdl' : failed to load external entity "fake/wsdl" in C:\a.php on line 6 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72136&edit=1

« previous php.bugs (#232105) next »