File: gh-issue48.phpt

package info (click to toggle)
php-pecl-http 3.1.0%2B2.6.0-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,060 kB
  • ctags: 3,725
  • sloc: ansic: 37,486; xml: 818; php: 635; pascal: 164; makefile: 2
file content (177 lines) | stat: -rw-r--r-- 4,924 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
--TEST--
url errors
--SKIPIF--
<?php
include "skipif.inc";
?>
--FILE--
<?php
echo "Test\n";

function test($url, $flags = 0) {
	echo "# DEFAULT\n";
	try {
		echo new http\Url($url, null, $flags), "\n";
	} catch (Exception $e) {
		echo $e->getMessage(), "\n";
	} 
	
	echo "# IGNORE\n";
	echo new http\Url($url, null, $flags|http\Url::IGNORE_ERRORS), "\n";
	
	echo "# SILENT\n";
	echo new http\Url($url, null, $flags|http\Url::SILENT_ERRORS), "\n";
	
	echo "# IGNORE|SILENT\n";
	echo new http\Url($url, null, $flags|http\Url::IGNORE_ERRORS|http\Url::SILENT_ERRORS), "\n";
	echo "==========\n";
}

test("http://.foo.bar/?q=1");
test("http://..foo.bar/i.x");
test("http://foo..bar/i..x");
test("http://-foo.bar");
test("http://--foo.bar");
test("http://f--oo.bar");
test("htto://foo.bar/?q=%");
test("htto://foo.bar/?q=%", http\Url::PARSE_TOPCT);
test("http://a\xc3\xc3b");
test("http://[foobar]:123");
test("#/?foo=&#", http\Url::PARSE_MBUTF8);

?>

===DONE===
--EXPECTF--
Test
# DEFAULT
http\Url::__construct(): Failed to parse host; unexpected '.' at pos 0 in '.foo.bar/?q=1'
# IGNORE

Warning: http\Url::__construct(): Failed to parse host; unexpected '.' at pos 0 in '.foo.bar/?q=1' in %sgh-issue48.php on line %d
http://foo.bar/?q=1
# SILENT

# IGNORE|SILENT
http://foo.bar/?q=1
==========
# DEFAULT
http\Url::__construct(): Failed to parse host; unexpected '.' at pos 0 in '..foo.bar/i.x'
# IGNORE

Warning: http\Url::__construct(): Failed to parse host; unexpected '.' at pos 0 in '..foo.bar/i.x' in %sgh-issue48.php on line %d

Warning: http\Url::__construct(): Failed to parse host; unexpected '.' at pos 1 in '..foo.bar/i.x' in %sgh-issue48.php on line %d
http://foo.bar/i.x
# SILENT

# IGNORE|SILENT
http://foo.bar/i.x
==========
# DEFAULT
http\Url::__construct(): Failed to parse host; unexpected '.' at pos 4 in 'foo..bar/i..x'
# IGNORE

Warning: http\Url::__construct(): Failed to parse host; unexpected '.' at pos 4 in 'foo..bar/i..x' in %sgh-issue48.php on line %d
http://foo.bar/i..x
# SILENT

# IGNORE|SILENT
http://foo.bar/i..x
==========
# DEFAULT
http\Url::__construct(): Failed to parse host; unexpected '-' at pos 0 in '-foo.bar'
# IGNORE

Warning: http\Url::__construct(): Failed to parse host; unexpected '-' at pos 0 in '-foo.bar' in %sgh-issue48.php on line %d
http://foo.bar/
# SILENT

# IGNORE|SILENT
http://foo.bar/
==========
# DEFAULT
http\Url::__construct(): Failed to parse host; unexpected '-' at pos 0 in '--foo.bar'
# IGNORE

Warning: http\Url::__construct(): Failed to parse host; unexpected '-' at pos 0 in '--foo.bar' in %sgh-issue48.php on line %d

Warning: http\Url::__construct(): Failed to parse host; unexpected '-' at pos 1 in '--foo.bar' in %sgh-issue48.php on line %d
http://foo.bar/
# SILENT

# IGNORE|SILENT
http://foo.bar/
==========
# DEFAULT
http://f--oo.bar/
# IGNORE
http://f--oo.bar/
# SILENT
http://f--oo.bar/
# IGNORE|SILENT
http://f--oo.bar/
==========
# DEFAULT
http\Url::__construct(): Failed to parse query; invalid percent encoding at pos 2 in 'q=%'
# IGNORE

Warning: http\Url::__construct(): Failed to parse query; invalid percent encoding at pos 2 in 'q=%' in %sgh-issue48.php on line %d
htto://foo.bar/?q=%
# SILENT

# IGNORE|SILENT
htto://foo.bar/?q=%
==========
# DEFAULT
http\Url::__construct(): Failed to parse query; invalid percent encoding at pos 2 in 'q=%'
# IGNORE

Warning: http\Url::__construct(): Failed to parse query; invalid percent encoding at pos 2 in 'q=%' in %sgh-issue48.php on line %d
htto://foo.bar/?q=%25
# SILENT

# IGNORE|SILENT
htto://foo.bar/?q=%25
==========
# DEFAULT
http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0xc3 at pos 1 in 'a%c%cb'
# IGNORE

Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0xc3 at pos 1 in 'a%c%cb' in %sgh-issue48.php on line %d

Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0xc3 at pos 2 in 'a%c%cb' in %sgh-issue48.php on line %d
http://ab/
# SILENT

# IGNORE|SILENT
http://ab/
==========
# DEFAULT
http\Url::__construct(): Failed to parse hostinfo; unexpected '[' at pos 0 in '[foobar]:123'
# IGNORE

Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected '[' at pos 0 in '[foobar]:123' in %sgh-issue48.php on line %d

Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0x5b at pos 0 in '[foobar]:123' in %sgh-issue48.php on line %d

Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0x5d at pos 7 in '[foobar]:123' in %sgh-issue48.php on line %d
http://foobar:123/
# SILENT

# IGNORE|SILENT
http://foobar:123/
==========
# DEFAULT
http\Url::__construct(): Failed to parse fragment; invalid fragment identifier at pos 7 in '/?foo=&#'
# IGNORE

Warning: http\Url::__construct(): Failed to parse fragment; invalid fragment identifier at pos 7 in '/?foo=&#' in %sgh-issue48.php on line %d
#/?foo=&#
# SILENT

# IGNORE|SILENT
#/?foo=&#
==========

===DONE===