|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2024-09-10 18:24 UTC] git@php.net
[2024-09-10 18:24 UTC] git@php.net
-Status: Open
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 03:00:02 2025 UTC |
Description: ------------ When creating a stream context with http headers as a numerically indexed array this is ignored by SOAPClient (works as expected) with a string of headers. The documentation for the HTTP stream context says an array is supported. In soap/php_http.c where the context headers are queried it appears that arrays are ignored. This also seems to be the case in PHP 7. void http_context_headers(php_stream_context* context, zend_bool has_authorization, zend_bool has_proxy_authorization, zend_bool has_cookies, smart_str* soap_headers) { zval *tmp; if (context && (tmp = php_stream_context_get_option(context, "http", "header")) != NULL && Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp)) { Test script: --------------- $wdsl = 'path_to_wdsl'; $headers = array('Accept: application/soap+xml', 'X-Custom: customheader'); $context = stream_context_create(array('http' => array('header' => $headers))); $client = new SoapClient($wdsl, array('cache_wsdl' => WSDL_CACHE_NONE, 'stream_context' => $context, 'trace'=>1)); // do SOAP request //$client->__doRequest(string $request , string $location , string $action , int $version); echo $client->__getLastRequestHeaders()); Expected result: ---------------- Expect to see the headers added to request but not seen unless string form is used