prepare v4.2.5
[m6w6/ext-http] / tests / info001.phpt
1 --TEST--
2 invalid HTTP info
3 --SKIPIF--
4 <?php include "skipif.inc"; ?>
5 --INI--
6 zend.exception_ignore_args=off
7 --FILE--
8 <?php
9
10 try {
11 var_dump(new http\Message("GET HTTP/1.1"));
12 } catch (Exception $e) {
13 echo $e, "\n";
14 }
15 try {
16 var_dump(new http\Message("GET HTTP/1.123"));
17 } catch (Exception $e) {
18 echo $e, "\n";
19 }
20 try {
21 var_dump(new http\Message("GETHTTP/1.1"));
22 } catch (Exception $e) {
23 echo $e, "\n";
24 }
25 var_dump(new http\Message("GET / HTTP/1.1"));
26 ?>
27 DONE
28 --EXPECTF--
29 http\Exception\BadMessageException: http\Message::__construct(): Failed to parse headers: unexpected character '\040' at pos 3 of 'GET HTTP/1.1' in %s
30 Stack trace:
31 #0 %s: http\Message->__construct('GET HTTP/1.1')
32 #1 {main}
33 http\Exception\BadMessageException: http\Message::__construct(): Failed to parse headers: unexpected character '\040' at pos 3 of 'GET HTTP/1.123' in %s
34 Stack trace:
35 #0 %s: http\Message->__construct('GET HTTP/1.123')
36 #1 {main}
37 http\Exception\BadMessageException: http\Message::__construct(): Failed to parse headers: unexpected character '\057' at pos 7 of 'GETHTTP/1.1' %s
38 Stack trace:
39 #0 %s: http\Message->__construct('GETHTTP/1.1')
40 #1 {main}
41 object(http\Message)#%d (9) {
42 ["type":protected]=>
43 int(1)
44 ["body":protected]=>
45 NULL
46 ["requestMethod":protected]=>
47 string(3) "GET"
48 ["requestUrl":protected]=>
49 string(1) "/"
50 ["responseStatus":protected]=>
51 string(0) ""
52 ["responseCode":protected]=>
53 int(0)
54 ["httpVersion":protected]=>
55 string(3) "1.1"
56 ["headers":protected]=>
57 array(0) {
58 }
59 ["parentMessage":protected]=>
60 NULL
61 }
62 DONE