1--TEST-- 2Bug #73182 (PHP SOAPClient does not support stream context HTTP headers in array form) 3--EXTENSIONS-- 4soap 5--SKIPIF-- 6<?php 7 if (!file_exists(__DIR__ . "/../../../../sapi/cli/tests/php_cli_server.inc")) { 8 echo "skip sapi/cli/tests/php_cli_server.inc required but not found"; 9 } 10?> 11--FILE-- 12<?php 13 14include __DIR__ . "/../../../../sapi/cli/tests/php_cli_server.inc"; 15 16$args = ["-d", "extension_dir=" . ini_get("extension_dir"), "-d", "extension=" . (substr(PHP_OS, 0, 3) == "WIN" ? "php_" : "") . "soap." . PHP_SHLIB_SUFFIX]; 17if (php_ini_loaded_file()) { 18 // Necessary such that it works from a development directory in which case extension_dir might not be the real extension dir 19 $args[] = "-c"; 20 $args[] = php_ini_loaded_file(); 21} 22$code = <<<'PHP' 23/* Receive */ 24$content = trim(file_get_contents("php://input")) . PHP_EOL; 25PHP; 26 27php_cli_server_start($code, null, $args); 28 29$client = new soapclient(NULL, [ 30 'location' => 'http://' . PHP_CLI_SERVER_ADDRESS, 31 'uri' => 'misc-uri', 32 'trace' => true, 33 'stream_context' => stream_context_create([ 34 'http' => [ 35 'header' => [ 36 // These 2 must be ignored because the soap http client sets them up 37 'Connection: close', 38 'User-Agent: bar', 39 // The following 2 must be included 40 'X-custom: foo', 41 'Content-Description: Foo', 42 ' X-custom2: trim me ', 43 ], 44 ], 45 ]), 46]); 47 48$client->__soapCall("foo", []); 49echo $client->__getLastRequestHeaders(); 50 51?> 52--EXPECTF-- 53POST / HTTP/1.1 54Host: localhost:%d 55Connection: Keep-Alive 56User-Agent: PHP-SOAP/%s 57Content-Type: text/xml; charset=utf-8 58SOAPAction: "misc-uri#foo" 59Content-Length: %d 60X-custom: foo 61Content-Description: Foo 62X-custom2: trim me 63