]> granicus.if.org Git - php/commitdiff
soap #69137 - Invert logic to be correct
authorKeith Smiley <ksmiley@salesforce.com>
Fri, 14 Oct 2016 03:56:24 +0000 (23:56 -0400)
committerKeith Smiley <ksmiley@salesforce.com>
Fri, 14 Oct 2016 03:56:24 +0000 (23:56 -0400)
ext/soap/php_http.c
ext/soap/tests/bug69137.phpt

index cb5550adb41827752351fefcc363bce0f7bdf12b..0659bd710eb0316a5ec192ab7368c669bf6c7b24 100644 (file)
@@ -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);
index a4d3baad88f1503f57c54e72852f66e48e5d039b..9160b91c2505683a89c22f5b45d7102d4bd7fa65 100644 (file)
@@ -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,