xref: /PHP-8.4/ext/soap/tests/bugs/bug44882.phpt (revision e1b59e9e)
1--TEST--
2Bug #44882 (SOAP extension object decoding bug)
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9class TestSoapClient extends SoapClient
10{
11    public function __doRequest($req, $loc, $act, $ver, $one_way = 0): string
12    {
13        return <<<XML
14<?xml version="1.0" encoding="UTF-8"?>
15<SOAP-ENV:Envelope
16  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
17  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18  xmlns:ns="urn:ebay:api:PayPalAPI">
19  <SOAP-ENV:Body id="_0">
20    <GetExpressCheckoutDetailsResponse xmlns="urn:ebay:api:PayPalAPI">
21      <Timestamp>2008-06-23T14:51:08Z</Timestamp>
22      <Ack>Success</Ack>
23      <CorrelationID>ae013a0ccdf13</CorrelationID>
24      <Version>50.000000</Version>
25      <Build>588340</Build>
26      <GetExpressCheckoutDetailsResponseDetails xsi:type="ns:GetExpressCheckoutDetailsResponseDetailsType">
27        <Token>EC-11Y75137T2399952C</Token>
28        <PayerInfo>
29          <Payer>example@example.com</Payer>
30          <PayerID>MU82WA43YXM9C</PayerID>
31          <PayerStatus>verified</PayerStatus>
32        </PayerInfo>
33      </GetExpressCheckoutDetailsResponseDetails>
34    </GetExpressCheckoutDetailsResponse>
35  </SOAP-ENV:Body>
36</SOAP-ENV:Envelope>
37XML;
38    }
39}
40
41$client = new TestSoapClient(__DIR__.'/bug44882.wsdl');
42print_r($client->GetExpressCheckoutDetails());
43?>
44--EXPECT--
45stdClass Object
46(
47    [Timestamp] => 2008-06-23T14:51:08Z
48    [Ack] => Success
49    [CorrelationID] => ae013a0ccdf13
50    [Version] => 50.000000
51    [Build] => 588340
52    [GetExpressCheckoutDetailsResponseDetails] => stdClass Object
53        (
54            [Token] => EC-11Y75137T2399952C
55            [PayerInfo] => stdClass Object
56                (
57                    [Payer] => example@example.com
58                    [PayerID] => MU82WA43YXM9C
59                    [PayerStatus] => verified
60                )
61
62        )
63
64)
65