From 3b9ba6195db2c17147b0fed4af3398320967002f Mon Sep 17 00:00:00 2001 From: Keith Smiley <ksmiley@salesforce.com> Date: Thu, 13 Oct 2016 23:56:24 -0400 Subject: [PATCH] soap #69137 - Invert logic to be correct --- ext/soap/php_http.c | 2 +- ext/soap/tests/bug69137.phpt | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index cb5550adb4..0659bd710e 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -242,7 +242,7 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph smart_str soap_headers = {0}; /* Set peer_name or name verification will try to use the proxy server name */ - if (context && (tmp = php_stream_context_get_option(context, "ssl", "peer_name")) != NULL) { + if (!context || (tmp = php_stream_context_get_option(context, "ssl", "peer_name")) == NULL) { ZVAL_STRING(&ssl_proxy_peer_name, phpurl->host); php_stream_context_set_option(PHP_STREAM_CONTEXT(stream), "ssl", "peer_name", &ssl_proxy_peer_name); zval_ptr_dtor(&ssl_proxy_peer_name); diff --git a/ext/soap/tests/bug69137.phpt b/ext/soap/tests/bug69137.phpt index a4d3baad88..9160b91c25 100644 --- a/ext/soap/tests/bug69137.phpt +++ b/ext/soap/tests/bug69137.phpt @@ -7,7 +7,7 @@ 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=0 +soap.wsdl_cache_enabled=1 --FILE-- <?php @@ -19,7 +19,12 @@ class IpLookup 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, -- 2.40.0