fix warnings
[m6w6/ext-http] / tests / gh-issue12.phpt
1 --TEST--
2 crash with bad url passed to http\Message::setRequestUrl()
3 --SKIPIF--
4 <?php include "skipif.inc"; ?>
5 --FILE--
6 <?php
7 echo "Test\n";
8
9 $urls = array(
10 "http://.foo.bar",
11 "http://foo..bar",
12 "http://foo.bar.",
13 );
14
15 foreach ($urls as $url) {
16 try {
17 (new http\Client\Request)->setRequestUrl($url);
18 printf("OK: %s\n", $url);
19 } catch (Exception $e) {
20 printf("%s\n", $e->getMessage());
21 }
22 }
23
24 ?>
25 ===DONE===
26 --EXPECT--
27 Test
28 http\Message::setRequestUrl(): Failed to parse host; unexpected '.' at pos 0 in '.foo.bar'
29 http\Message::setRequestUrl(): Failed to parse host; unexpected '.' at pos 4 in 'foo..bar'
30 OK: http://foo.bar.
31 ===DONE===