3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $wsdl = <<<'WSDL' <?xml version='1.0' encoding='UTF-8'?> <definitions name="ab" targetNamespace="urn:ab" xmlns:typens="urn:ab" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:ab"> <xsd:complexType name="A"> <xsd:sequence> <xsd:element name="x" type="xsd:anyType"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="Broken"> <xsd:sequence> <xsd:element name="completelyBroken" type="xsd:anyType"/> </xsd:sequence> </xsd:complexType> </xsd:schema> </types> <message name="f"> <part name="fRequest" type="typens:A"/> </message> <message name="fResponse"> <part name="fRequest" type="typens:A"/> </message> <portType name="abServerPortType"> <operation name="f"> <input message="typens:f"/> <output message="typens:fResponse"/> </operation> </portType> <binding name="abServerBinding" type="typens:abServerPortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="f"> <soap:operation soapAction="urn:abServerAction"/> <input> <soap:body namespace="urn:ab" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output> <soap:body namespace="urn:ab" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <service name="abService"> <port name="abServerPort" binding="typens:abServerBinding"> <soap:address location="http://localhost/dummy"/> </port> </service> </definitions> WSDL; file_put_contents('test.wsdl', $wsdl); function f($a) { return $a; } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $this->server->addFunction("f"); } function __doRequest($request, $location, $action, $version, $one_way = 0) { ob_start(); $this->server->handle($request); $response = ob_get_contents(); ob_end_clean(); return $response; } } class Broken { public $completelyBroken; } $client = new LocalSoapClient('test.wsdl', array('classmap' => array('Broken' => 'Broken')) ); $broken = new Broken(); $broken->completelyBroken = 'indeed it is'; print_r($client->f($broken));
based on eBeeI
Output for 5.4.0 - 7.1.0
Warning: file_put_contents(test.wsdl): failed to open stream: Permission denied in /in/mqC71 on line 59 Fatal error: Class 'SoapClient' not found in /in/mqC71 on line 65
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Warning: file_put_contents(test.wsdl): failed to open stream: Permission denied in /in/mqC71 on line 59 Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'test.wsdl' : failed to load external entity "test.wsdl" in /in/mqC71:67 Stack trace: #0 /in/mqC71(67): SoapClient->SoapClient('test.wsdl', Array) #1 /in/mqC71(87): LocalSoapClient->__construct('test.wsdl', Array) #2 {main} thrown in /in/mqC71 on line 67
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_SL in /in/mqC71 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_SL in /in/mqC71 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/mqC71 on line 3
Process exited with code 255.