move to PHP-7.4 as current GA
[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 $c = new http\Client\Request;
18 $c->setRequestUrl($url);
19 printf("OK: %s\n", $url);
20 } catch (Exception $e) {
21 printf("%s\n", $e->getMessage());
22 }
23 }
24
25 ?>
26 ===DONE===
27 --EXPECT--
28 Test
29 http\Message::setRequestUrl(): Failed to parse host; unexpected '.' at pos 0 in '.foo.bar'
30 http\Message::setRequestUrl(): Failed to parse host; unexpected '.' at pos 4 in 'foo..bar'
31 OK: http://foo.bar.
32 ===DONE===