summaryrefslogtreecommitdiff
path: root/ext/soap/tests/bug69137.phpt
blob: 9160b91c2505683a89c22f5b45d7102d4bd7fa65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--TEST--
SOAP Bug #69137 - Peer verification fails when using a proxy with SoapClient
--SKIPIF--
<?php
require_once('skipif.inc');
if (getenv("SKIP_ONLINE_TESTS")) { die("skip test requiring internet connection"); }
if (!getenv('http_proxy')) { die("skip test unless an HTTP/HTTPS proxy server is specified in http_proxy environment variable"); }
?>
--INI--
soap.wsdl_cache_enabled=1
--FILE--
<?php

class IpLookup
{
    public $licenseKey;
    public $ipAddress;
}

list ($proxyHost, $proxyPort) = explode(':', str_replace('http://', '', $_ENV['http_proxy']));

// Prime the WSDL cache because that request sets peer_name on the HTTP context
// and masks the SOAP bug.
$testServiceWsdl = 'https://ws.cdyne.com/ip2geo/ip2geo.asmx?wsdl';
$client = new SoapClient($testServiceWsdl);
unset($client);

$parameters = [
	'proxy_host' => $proxyHost,
	'proxy_port' => $proxyPort,
	'trace' => 1,
];
$client = new SoapClient($testServiceWsdl, $parameters);

$lookup = new IpLookup();
$lookup->licenseKey = 0;
$lookup->ipAddress = '72.52.91.14';

$result = $client->ResolveIP($lookup);

if ($result && is_object($result) && $result->ResolveIPResult && is_object($result->ResolveIPResult)) {
	print "successful lookup";
}
?>
--EXPECT--
successful lookup