|
| 1 | +--TEST-- |
| 2 | +Bug #76232 (SoapClient Cookie Header Semicolon) |
| 3 | +--EXTENSIONS-- |
| 4 | +soap |
| 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 | + |
| 14 | +include __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]; |
| 17 | +if (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; |
| 25 | +PHP; |
| 26 | + |
| 27 | +php_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 | +]); |
| 34 | + |
| 35 | +echo "=== Request with one cookie ===\n"; |
| 36 | + |
| 37 | +$client->__setCookie('testcookie1', 'true'); |
| 38 | +$client->__soapCall("foo", []); |
| 39 | +echo $client->__getLastRequestHeaders(); |
| 40 | + |
| 41 | +echo "=== Request with two cookies ===\n"; |
| 42 | + |
| 43 | +$client->__setCookie('testcookie2', 'true'); |
| 44 | +$client->__soapCall("foo", []); |
| 45 | + |
| 46 | +echo $client->__getLastRequestHeaders(); |
| 47 | +?> |
| 48 | +--EXPECTF-- |
| 49 | +=== Request with one cookie === |
| 50 | +POST / HTTP/1.1 |
| 51 | +Host: %s |
| 52 | +Connection: Keep-Alive |
| 53 | +User-Agent: PHP-SOAP/%s |
| 54 | +Content-Type: text/xml; charset=utf-8 |
| 55 | +SOAPAction: "misc-uri#foo" |
| 56 | +Content-Length: %d |
| 57 | +Cookie: testcookie1=true |
| 58 | + |
| 59 | +=== Request with two cookies === |
| 60 | +POST / HTTP/1.1 |
| 61 | +Host: %s |
| 62 | +Connection: Keep-Alive |
| 63 | +User-Agent: PHP-SOAP/%s |
| 64 | +Content-Type: text/xml; charset=utf-8 |
| 65 | +SOAPAction: "misc-uri#foo" |
| 66 | +Content-Length: %d |
| 67 | +Cookie: testcookie1=true; testcookie2=true |
0 commit comments