3v4l.org

run code in 300+ PHP versions simultaneously
<?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));
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: file_put_contents(): open_basedir restriction in effect. File(test.wsdl) is not within the allowed path(s): (/tmp:/in:/etc) in /in/mqC71 on line 59 Warning: file_put_contents(test.wsdl): Failed to open stream: Operation not permitted in /in/mqC71 on line 59 Fatal error: Uncaught Error: Class "SoapClient" not found in /in/mqC71:65 Stack trace: #0 {main} thrown in /in/mqC71 on line 65
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: file_put_contents(): open_basedir restriction in effect. File(test.wsdl) is not within the allowed path(s): (/tmp:/in:/etc) in /in/mqC71 on line 59 Warning: file_put_contents(test.wsdl): Failed to open stream: Operation not permitted in /in/mqC71 on line 59 Fatal error: Uncaught Error: Class "SoapClient" not found in /in/mqC71:65 Stack trace: #0 {main} thrown in /in/mqC71 on line 65
Process exited with code 255.
Output for 8.0.13
Warning: file_put_contents(test.wsdl): Failed to open stream: Read-only file system in /in/mqC71 on line 59 Fatal error: Uncaught Error: Class "SoapClient" not found in /in/mqC71:65 Stack trace: #0 {main} thrown in /in/mqC71 on line 65
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33
Warning: file_put_contents(test.wsdl): failed to open stream: Read-only file system in /in/mqC71 on line 59 Fatal error: Uncaught Error: Class 'SoapClient' not found in /in/mqC71:65 Stack trace: #0 {main} thrown in /in/mqC71 on line 65
Process exited with code 255.
Output for 7.3.16 - 7.3.31, 7.4.0 - 7.4.32
Warning: file_put_contents(): open_basedir restriction in effect. File(test.wsdl) is not within the allowed path(s): (/tmp:/in:/etc) in /in/mqC71 on line 59 Warning: file_put_contents(test.wsdl): failed to open stream: Operation not permitted in /in/mqC71 on line 59 Fatal error: Uncaught Error: Class 'SoapClient' not found in /in/mqC71:65 Stack trace: #0 {main} thrown in /in/mqC71 on line 65
Process exited with code 255.
Output for 7.2.29 - 7.2.33
Warning: file_put_contents(): open_basedir restriction in effect. File(test.wsdl) is not within the allowed path(s): (/tmp:/in:/etc) in /in/mqC71 on line 59 Warning: file_put_contents(test.wsdl): failed to open stream: Operation not permitted 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 7.1.20, 7.2.6
Warning: file_put_contents(): open_basedir restriction in effect. File(test.wsdl) is not within the allowed path(s): (/tmp:/in) in /in/mqC71 on line 59 Warning: file_put_contents(test.wsdl): failed to open stream: Operation not permitted 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.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.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.1.6, 5.2.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.3.11, 4.4.0 - 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.

preferences:
257.21 ms | 401 KiB | 353 Q