bug69137.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. SOAP Bug #69137 - Peer verification fails when using a proxy with SoapClient
  3. --EXTENSIONS--
  4. soap
  5. --SKIPIF--
  6. <?php
  7. if (getenv("SKIP_ONLINE_TESTS")) { die("skip test requiring internet connection"); }
  8. if (!getenv('http_proxy')) { die("skip test unless an HTTP/HTTPS proxy server is specified in http_proxy environment variable"); }
  9. ?>
  10. --INI--
  11. soap.wsdl_cache_enabled=1
  12. --FILE--
  13. <?php
  14. class IpLookup
  15. {
  16. public $licenseKey;
  17. public $ipAddress;
  18. }
  19. list ($proxyHost, $proxyPort) = explode(':', str_replace('http://', '', $_ENV['http_proxy']));
  20. // Prime the WSDL cache because that request sets peer_name on the HTTP context
  21. // and masks the SOAP bug.
  22. $testServiceWsdl = 'https://ws.cdyne.com/ip2geo/ip2geo.asmx?wsdl';
  23. $client = new SoapClient($testServiceWsdl);
  24. unset($client);
  25. $parameters = [
  26. 'proxy_host' => $proxyHost,
  27. 'proxy_port' => $proxyPort,
  28. 'trace' => 1,
  29. ];
  30. $client = new SoapClient($testServiceWsdl, $parameters);
  31. $lookup = new IpLookup();
  32. $lookup->licenseKey = 0;
  33. $lookup->ipAddress = '72.52.91.14';
  34. $result = $client->ResolveIP($lookup);
  35. if ($result && is_object($result) && $result->ResolveIPResult && is_object($result->ResolveIPResult)) {
  36. print "successful lookup";
  37. }
  38. ?>
  39. --EXPECT--
  40. successful lookup