Skip to content

Instantly share code, notes, and snippets.

@tPl0ch
Created August 22, 2012 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tPl0ch/cc37549c71f51c5968b0 to your computer and use it in GitHub Desktop.
Save tPl0ch/cc37549c71f51c5968b0 to your computer and use it in GitHub Desktop.
xdebug segfault reproducable
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://ws.lv.softfair-server.de/lvwebservice" xmlns:s1="http://www.softfair-services.de/dotnet2/usercenter/UserService" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://ws.lv.softfair-server.de/lvwebservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://ws.lv.softfair-server.de/lvwebservice">
<s:import namespace="http://www.softfair-services.de/dotnet2/usercenter/UserService" />
<s:element name="get_Login_Object">
<s:complexType />
</s:element>
<s:element name="get_Login_ObjectResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="get_Login_ObjectResult" type="s1:Login" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.softfair-services.de/dotnet2/usercenter/UserService">
<s:complexType name="Login">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="login_name" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="login_passwort" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="login_status" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="gruppe_id" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="untergruppe_id" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="produkt_id" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="user_id" type="s:int" />
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="get_Login_ObjectSoapIn">
<wsdl:part name="parameters" element="tns:get_Login_Object" />
</wsdl:message>
<wsdl:message name="get_Login_ObjectSoapOut">
<wsdl:part name="parameters" element="tns:get_Login_ObjectResponse" />
</wsdl:message>
<wsdl:portType name="LV_ServiceSoap">
<wsdl:operation name="get_Login_Object">
<wsdl:input message="tns:get_Login_ObjectSoapIn" />
<wsdl:output message="tns:get_Login_ObjectSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="LV_ServiceSoap" type="tns:LV_ServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="get_Login_Object">
<soap:operation soapAction="http://ws.lv.softfair-server.de/lvwebservice/get_Login_Object" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="LV_ServiceSoap12" type="tns:LV_ServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="get_Login_Object">
<soap12:operation soapAction="http://ws.lv.softfair-server.de/lvwebservice/get_Login_Object" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="LV_Service">
<wsdl:port name="LV_ServiceSoap" binding="tns:LV_ServiceSoap">
<soap:address location="http://demo.softfair-server.de/dotnet2/lvwebservice_v3/lv_service.asmx" />
</wsdl:port>
<wsdl:port name="LV_ServiceSoap12" binding="tns:LV_ServiceSoap12">
<soap12:address location="http://demo.softfair-server.de/dotnet2/lvwebservice_v3/lv_service.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<?php
namespace Testcase;
abstract class SoapTypeAbstract {
public abstract function toXml($object);
public function fromXml($xml)
{
$node = new \SimpleXMLElement($xml);
$namespaces = $Node->getNamespaces(true);
foreach ($namespaces as $prefix => $ns) {
$node->registerXPathNamespace($prefix, $ns);
}
return $node;
}
}
class SoapTypeAbstractTest extends \PHPUnit_Framework_TestCase
{
public $soapOptions = array(
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
'soap_version' => SOAP_1_2,
'exceptions' => true,
'encoding' => 'UTF-8',
'trace' => true
);
public $wsdl;
public function setUp()
{
$this->type = $this->getMockForAbstractClass(
'\Testcase\SoapTypeAbstract',
array(),
'',
true, true, true,
array('toXml', 'fromXml'));
$this->wsdl = __DIR__ . '/lv_demo_service.wsdl';
$this->soapOptions['typemap'] = array(
array(
'type_name' => 'get_Login_ObjectResponse',
'type_ns' => 'http://ws.lv.softfair-server.de/lvwebservice',
'from_xml' => array(&$this->type, 'fromXml'),
'to_xml' => array(&$this->type, 'toXml')
)
);
$this->client = $this->getMock('\SoapClient', array('__doRequest'), array($this->wsdl, $this->soapOptions));
}
public function testTypemapCallsFromXml()
{
$request = <<<'REQUEST'
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://ws.lv.softfair-server.de/lvwebservice"><env:Body><ns1:get_Login_Object/></env:Body></env:Envelope>
REQUEST;
$response = <<<'RESPONSE'
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:ns1="http://ws.lv.softfair-server.de/lvwebservice" xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<env:Body>
<ns1:get_Login_ObjectResponse>
<get_Login_ObjectResult>
<gruppe_id xmlns="http://www.softfair-services.de/dotnet2/usercenter/UserService">-1</gruppe_id>
<untergruppe_id xmlns="http://www.softfair-services.de/dotnet2/usercenter/UserService">-1</untergruppe_id>
<produkt_id xmlns="http://www.softfair-services.de/dotnet2/usercenter/UserService">43</produkt_id>
<user_id xmlns="http://www.softfair-services.de/dotnet2/usercenter/UserService">-1</user_id>
</get_Login_ObjectResult>
</ns1:get_Login_ObjectResponse>
</env:Body>
</env:Envelope>
RESPONSE;
$convertedTypeXml = <<<'CONVERTED'
<ns1:get_Login_ObjectResponse xmlns:ns1="http://ws.lv.softfair-server.de/lvwebservice"><get_Login_ObjectResult><gruppe_id xmlns="http://www.softfair-services.de/dotnet2/usercenter/UserService">-1</gruppe_id><untergruppe_id xmlns="http://www.softfair-services.de/dotnet2/usercenter/UserService">-1</untergruppe_id><produkt_id xmlns="http://www.softfair-services.de/dotnet2/usercenter/UserService">43</produkt_id><user_id xmlns="http://www.softfair-services.de/dotnet2/usercenter/UserService">-1</user_id></get_Login_ObjectResult></ns1:get_Login_ObjectResponse>
CONVERTED;
$return = new \stdClass();
$return->get_Login_ObjectResponse = new \stdClass;
$login =& $return->get_Login_ObjectResponse;
$login->gruppe_id = -1;
$login->untergruppe_id = -1;
$login->produkt_id = 43;
$login->user_id = -1;
unset($login);
$this->client
->expects($this->once())
->method('__doRequest')
->with(
$request,
'http://demo.softfair-server.de/dotnet2/lvwebservice_v3/lv_service.asmx',
'http://ws.lv.softfair-server.de/lvwebservice/get_Login_Object',
SOAP_1_2)
->will($this->returnValue($response));
$this->type
->expects($this->once())
->method('fromXml')
->with($convertedTypeXml)
->will($this->returnValue($return));
$result = $this->client->get_Login_Object()->get_Login_ObjectResponse;
$this->assertEquals(-1, $result->gruppe_id);
$this->assertEquals(-1, $result->untergruppe_id);
$this->assertEquals(43, $result->produkt_id);
$this->assertEquals(-1, $result->user_id);
}
protected function tearDown()
{
unset($this->type, $this->client);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment