From: Anatol Belski Date: Mon, 10 Oct 2016 13:59:52 +0000 (+0200) Subject: add test for bug #73037 X-Git-Tag: php-5.6.28RC1~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=256b150a963337eeea5d42e3769ebf5ae45f50c8;p=php add test for bug #73037 --- diff --git a/ext/soap/tests/bug73037.phpt b/ext/soap/tests/bug73037.phpt new file mode 100644 index 0000000000..e68f621607 --- /dev/null +++ b/ext/soap/tests/bug73037.phpt @@ -0,0 +1,180 @@ +--TEST-- +Bug #73037 SoapServer reports Bad Request when gzipped, var 0 +--SKIPIF-- + +--FILE-- + + Empire Burlesque + Bob Dylan + USA + Columbia + 10.90 + 1985 + "; + + $begin = ''; + $end = ''; + + $min = strlen($begin) + strlen($piece) + strlen($end); + $max = $max < $min ? $min : $max; + + $data = $begin; + $data .= $piece; + while (strlen($data) + strlen($end) < $max) { + /* Randomize a bit, taking gzip in account. */ + $tmp = str_replace( + array( + "Empire Burlesque", + "Bob Dylan", + ), + array( + md5(uniqid()), + sha1(uniqid()), + ), + $piece + ); + + if (strlen($begin) + strlen($tmp) + strlen($end) > $max) { + break; + } + + $data .= $tmp; + } + $data .= $end; + + return $data; +} + +$router = "bug73037_server.php"; +$args = substr(PHP_OS, 0, 3) == 'WIN' ? "-d extension_dir=" . ini_get("extension_dir") . " -d extension=php_soap.dll" : ""; +$code = <<<'PHP' +$s = new SoapServer(NULL, array('uri' => 'http://here')); +$s->setObject(new stdclass()); +$s->handle(); +PHP; + +php_cli_server_start($code, $router, $args); + +foreach (array(1024-1, 1024*8-3, 1024*9+1, 1024*16-1, 1024*32-5, 1024*64+3, 1024*128-7) as $k => $i) { + echo "Iteration $k\n\n"; + + /* with and without compression */ + foreach (array(false, true) as $b) { + $data = get_data($i); + if ($b) { + $data = gzencode($data); + } + $len = strlen($data); + + //echo "len=$len\n"; + + $hdrs = <<"); + if (false === $pos) { + echo $out; + goto cleanup; + } + $pos0 = $pos + strlen(""); + $pos = strpos($out, ""); + if (false === $pos) { + echo $out; + goto cleanup; + } + $len = $pos - $pos0; + echo substr($out, $pos0, $len); + } + +cleanup: + fclose($fp); + + echo "\n\n"; + } +} + +?> +==DONE== +--CLEAN-- + +--EXPECT-- +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==