Bug #73182 [NEW]: PHP SOAPClient does not support stream context HTTP headers in array form
From: scottie at live dot com
Operating system: Centos6
PHP version: 5.6.26
Package: SOAP related
Bug Type: Bug
Bug description:PHP SOAPClient does not support stream context HTTP headers in array form
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
--
Edit bug report at https://bugs.php.net/bug.php?id=73182&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73182&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73182&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73182&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73182&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73182&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73182&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73182&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73182&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73182&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73182&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73182&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73182&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73182&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73182&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73182&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73182&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73182&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73182&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73182&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73182&r=mysqlcfg
Thread (1 message)
- scottie at live dot com