Bug #72136 [NEW]: Instancing SoapClient causing SimpleXMLElement::asXML method doesn't work
| From: | michal at lipek dot net | Date: | Mon, 02 May 2016 07:04:53 +0000 |
| Subject: | Bug #72136 [NEW]: Instancing SoapClient causing SimpleXMLElement::asXML method doesn't work | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-200853@lists.php.net to get a copy of this message | ||
From: michal at lipek dot net
Operating system: Linux, Windows
PHP version: 7.0.6
Package: SimpleXML related
Bug Type: Bug
Bug description:Instancing SoapClient causing SimpleXMLElement::asXML method doesn't work
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 bug report at https://bugs.php.net/bug.php?id=72136&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72136&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72136&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72136&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72136&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72136&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72136&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72136&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72136&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72136&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72136&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72136&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72136&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72136&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72136&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72136&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72136&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72136&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72136&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72136&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72136&r=mysqlcfg