PHP  
 PHP_7_3
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/soap/tests/custom_content_type.phpt ('SOAP customized Content-Type, eg. SwA use case')

Script

1: <?php
2:
3:
include __DIR__ "/../../../sapi/cli/tests/php_cli_server.inc";
4:
5:
$args substr(PHP_OS03) == 'WIN' "-d extension_dir=" ini_get("extension_dir") . " -d extension=php_soap.dll" "";
6:
$code = <<<'PHP'
7:
/* Receive */
8: $content = trim(file_get_contents("php://input")) . PHP_EOL;
9:
PHP;
10:
11:
php_cli_server_start($codefalse$args);
12:
13:
$client = new soapclient(NULL, [
14:   
'location' => 'http://' PHP_CLI_SERVER_ADDRESS,
15:   
'uri' => 'misc-uri',
16:   
'soap_version' => SOAP_1_2,
17:   
'user_agent' => 'Vincent JARDIN, test headers',
18:   
'trace' => true/* record the headers before sending */
19:   
'stream_context' => stream_context_create([
20:     
'http' => [
21:       
'header' => sprintf("MIME-Version: 1.0\r\n"),
22:       
'content_type' => sprintf("Multipart/Related")
23:     ],
24:   ]),
25: ]);
26:
27:
$client->__soapCall("foo", [ 'arg1' => "XXXbar"]);
28:
29:
$headers $client->__getLastRequestHeaders();
30:
31: if (
strpos($headers'Multipart/Related; action="misc-uri#foo"') === FALSE)
32:   
printf("Content-Type NOK %s" PHP_EOL$headers);
33: else
34:   
printf("Content-Type OK" PHP_EOL);
35:
36:
/*
37:  * In case of an empty content-type, let's fallback to the default content.
38:  */
39:
$client2 = new soapclient(NULL, [
40:   
'location' => 'http://' PHP_CLI_SERVER_ADDRESS,
41:   
'uri' => 'misc-uri',
42:   
'soap_version' => SOAP_1_2,
43:   
'user_agent' => 'Vincent JARDIN, test headers',
44:   
'trace' => true/* record the headers before sending */
45:   
'stream_context' => stream_context_create([
46:     
'http' => [
47:       
'header' => sprintf("MIME-Version: 1.0\r\n"),
48:       
'content_type' => sprintf("")
49:     ],
50:   ]),
51: ]);
52:
53:
$client2->__soapCall("foo", [ 'arg1' => "XXXbar"]);
54:
55:
$headers $client2->__getLastRequestHeaders();
56:
57: if (
strpos($headers'Content-Type: application/soap+xml; charset=utf-8; action="misc-uri#foo"') === FALSE)
58:   
printf("Content-Type Default NOK %s" PHP_EOL$headers);
59: else
60:   
printf("Content-Type Default OK" PHP_EOL);
61:
?>
62:
==DONE==
63:

Expected

Content-Type OK
Content-Type Default OK
==DONE==

Output

Unable to connect to server

Diff

001+ Unable to connect to server
001- Content-Type OK
002- Content-Type Default OK
003- ==DONE==

 

Generated at Thu, 14 Nov 2019 02:24:20 +0000 (11 hours ago)

Copyright © 2005-2019 The PHP Group
All rights reserved.