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

Test Failure Report for ext/soap/tests/bug73037.phpt ('Bug #73037 SoapServer reports Bad Request when gzipped, var 0')

Script

1: <?php
2:
3:
include dirname(__FILE__) . "/../../../sapi/cli/tests/php_cli_server.inc";
4:
5: function 
get_data($max)
6: {
7:     
$piece "<CD>
8:         <TITLE>Empire Burlesque</TITLE>
9:         <ARTIST>Bob Dylan</ARTIST>
10:         <COUNTRY>USA</COUNTRY>
11:         <COMPANY>Columbia</COMPANY>
12:         <PRICE>10.90</PRICE>
13:         <YEAR>1985</YEAR>
14:     </CD>"
;
15:
16:     
$begin '<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CATALOG>';
17:     
$end '</CATALOG></soapenv:Body></soapenv:Envelope>';
18:
19:     
$min strlen($begin) + strlen($piece) + strlen($end);
20:     
$max $max $min $min $max;
21:
22:     
$data $begin;
23:     
$data .= $piece;
24:     while (
strlen($data) + strlen($end) < $max) {
25:         
/* Randomize a bit, taking gzip in account. */
26:         
$tmp str_replace(
27:             array(
28:                 
"Empire Burlesque",
29:                 
"Bob Dylan",
30:             ),
31:             array(
32:                 
md5(uniqid()),
33:                 
sha1(uniqid()),
34:             ),
35:             
$piece
36:         
);
37:
38:         if (
strlen($begin) + strlen($tmp) + strlen($end) > $max) {
39:             break;
40:         }
41:
42:         
$data .= $tmp;
43:     }
44:     
$data .= $end;
45:
46:     return 
$data;
47: }
48:
49:
$router "bug73037_server.php";
50:
$args substr(PHP_OS03) == 'WIN' "-d extension_dir=" ini_get("extension_dir") . " -d extension=php_soap.dll" "";
51:
$code = <<<'PHP'
52:
$s = new SoapServer(NULL, array('uri' => 'http://here'));
53: $s->setObject(new stdclass());
54: $s->handle();
55:
PHP;
56:
57:
php_cli_server_start($code$router$args);
58:
59: foreach (array(
1024-11024*8-31024*9+11024*16-11024*32-51024*64+31024*128-7) as $k => $i) {
60:     echo 
"Iteration $k\n\n";
61:
62:     
/* with and without compression */
63:     
foreach (array(falsetrue) as $b) {
64:         
$data get_data($i);
65:         if (
$b) {
66:             
$data gzencode($data);
67:         }
68:         
$len strlen($data);
69:
70:         
//echo "len=$len\n";
71:
72:         
$hdrs = <<<HDRS
73:
POST /bug73037_server.php HTTP/1.1
74: Content-Type: application/soap+xml; charset=UTF-8
75: Accept: application/soap+xml, application/dime, multipart/related, text/*
76: SOAPAction: "urn:adressen#adressen#SetAda"
77: Expect: 100-continue
78: Content-Length: 
${len}
79:
HDRS;
80:         if (
$b) {
81:             
$hdrs .="\nContent-Encoding: gzip";        
82:         }
83:         
//echo "Headers sent:\n$hdrs\n\n";
84:         
$fp fsockopen(PHP_CLI_SERVER_HOSTNAMEPHP_CLI_SERVER_PORT$errno$errstr5);
85:         if (!
$fp) {
86:           die(
"connect failed");
87:         }
88:
89:         if(
fwrite($fp"$hdrs\n\n$data")) {
90:             
$out "";
91:             while (!
feof($fp)) {
92:                 
$out .= fread($fp1024);
93:             }
94:
95:             
$pos strpos($out"<env:Text>");
96:             if (
false === $pos) {
97:                 echo 
$out;
98:                 goto 
cleanup;
99:             }
100:             
$pos0 $pos strlen("<env:Text>");
101:             
$pos strpos($out"</env:Text>");
102:             if (
false === $pos) {
103:                 echo 
$out;
104:                 goto 
cleanup;
105:             }
106:             
$len $pos $pos0;
107:             echo 
substr($out$pos0$len);
108:         }
109:
110:
cleanup:
111:         
fclose($fp);
112:
113:         echo 
"\n\n";
114:         }
115: }
116:
117:
?>
118:
==DONE==
119:

Expected

Iteration 0

Function 'CATALOG' doesn't exist

Function 'CATALOG' doesn't exist

Iteration 1

Function 'CATALOG' doesn't exist

Function 'CATALOG' doesn't exist

Iteration 2

Function 'CATALOG' doesn't exist

Function 'CATALOG' doesn't exist

Iteration 3

Function 'CATALOG' doesn't exist

Function 'CATALOG' doesn't exist

Iteration 4

Function 'CATALOG' doesn't exist

Function 'CATALOG' doesn't exist

Iteration 5

Function 'CATALOG' doesn't exist

Function 'CATALOG' doesn't exist

Iteration 6

Function 'CATALOG' doesn't exist

Function 'CATALOG' doesn't exist

==DONE==

Output

Unable to connect to server

Diff

001+ Unable to connect to server
001- Iteration 0
002- 
003- Function 'CATALOG' doesn't exist
004- 
005- Function 'CATALOG' doesn't exist
006- 
007- Iteration 1
008- 
009- Function 'CATALOG' doesn't exist
010- 
011- Function 'CATALOG' doesn't exist
012- 
013- Iteration 2
014- 
015- Function 'CATALOG' doesn't exist
016- 
017- Function 'CATALOG' doesn't exist
018- 
019- Iteration 3
020- 
021- Function 'CATALOG' doesn't exist
022- 
023- Function 'CATALOG' doesn't exist
024- 
025- Iteration 4
026- 
027- Function 'CATALOG' doesn't exist
028- 
029- Function 'CATALOG' doesn't exist
030- 
031- Iteration 5
032- 
033- Function 'CATALOG' doesn't exist
034- 
035- Function 'CATALOG' doesn't exist
036- 
037- Iteration 6
038- 
039- Function 'CATALOG' doesn't exist
040- 
041- Function 'CATALOG' doesn't exist
042- 
043- ==DONE==

 

Generated at Fri, 17 Nov 2017 10:18:10 +0000 (2 days ago)

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