facebook / facebook/hhvm

SoapClient does not send stream context http header array

Open
#8,047 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

The PHP manual for [HTTP context options](http://php.net/manual/en/context.http.php) says that ```header``` can be an array or string. However when a stream context with a HTTP header that is an array is used with SoapClient, both PHP and HHVM do not send the given headers.

### HHVM Version
```
HipHop VM 3.22.1 (rel)
Compiler: tags/HHVM-3.22.1-0-ge8ce62608d2d14e6418772b07ebaddcbdb37598f
Repo schema: 05fc45ee8e70c9f18dfb1e867219c8528be87996
```

### Standalone code, or other way to reproduce the problem
```php
['header' => $headers]]);
$client = new SoapClient(null, [
'location' => 'http://YOUR_SERVER_HOST/return_request_headers.php',
'stream_context' => $context,
'style' => SOAP_RPC,
'uri' => 'http://testing.dev',
]);
echo $client->__soapCall('getRequestHeaders', array());
```
```php
$value) {
if (substr($key, 0, 5) == 'HTTP_') {
$key = str_replace('_', '-', substr($key, 5));
$headers[] = "$key: $value";
}
}
return implode("\r\n", $headers);
}
}

$options = array('uri' => 'http://testing.dev');
$server = new SoapServer(null, $options);
$server->setClass('MyAPI');
$server->handle();
```

### Expected result
```
HOST: YOUR_SERVER_HOST
ACCEPT: */*
ACCEPT-ENCODING: deflate, gzip
SOAPACTION: "http://testing.dev#getRequestHeaders"
X-TEST-ELEMENT-2: element2
X-TEST-ELEMENT-1: element1
```

### Actual result
```

Notice: Array to string conversion in /home/jamesrichards/hhvm/test_stream_context_http_header.php on line 18
HOST: YOUR_SERVER_HOST
ACCEPT: */*
ACCEPT-ENCODING: deflate, gzip
SOAPACTION: "http://testing.dev#getRequestHeaders"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.