1--TEST--
2Test parse_url() function: Parse a load of URLs without specifying PHP_URL_FRAGMENT as the URL component
3--FILE--
4<?php
5/*
6 * Parse a load of URLs without specifying PHP_URL_FRAGMENT as the URL component
7 */
8include_once(__DIR__ . '/urls.inc');
9
10foreach ($urls as $url) {
11    echo "--> $url   : ";
12    var_dump(parse_url($url, PHP_URL_FRAGMENT));
13}
14
15echo "Done";
16?>
17--EXPECT--
18--> 64.246.30.37   : NULL
19--> http://64.246.30.37   : NULL
20--> http://64.246.30.37/   : NULL
21--> 64.246.30.37/   : NULL
22--> 64.246.30.37:80/   : NULL
23--> php.net   : NULL
24--> php.net/   : NULL
25--> http://php.net   : NULL
26--> http://php.net/   : NULL
27--> www.php.net   : NULL
28--> www.php.net/   : NULL
29--> http://www.php.net   : NULL
30--> http://www.php.net/   : NULL
31--> www.php.net:80   : NULL
32--> http://www.php.net:80   : NULL
33--> http://www.php.net:80/   : NULL
34--> http://www.php.net/index.php   : NULL
35--> www.php.net/?   : NULL
36--> www.php.net:80/?   : NULL
37--> http://www.php.net/?   : NULL
38--> http://www.php.net:80/?   : NULL
39--> http://www.php.net:80/index.php   : NULL
40--> http://www.php.net:80/foo/bar/index.php   : NULL
41--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php   : NULL
42--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5   : NULL
43--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/   : NULL
44--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php   : NULL
45--> http://www.php.net:80/this/../a/../deep/directory   : NULL
46--> http://www.php.net:80/this/../a/../deep/directory/   : NULL
47--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php   : NULL
48--> http://www.php.net:80/index.php   : NULL
49--> http://www.php.net:80/index.php?   : NULL
50--> http://www.php.net:80/#foo   : string(3) "foo"
51--> http://www.php.net:80/?#   : string(0) ""
52--> http://www.php.net:80/?test=1   : NULL
53--> http://www.php.net/?test=1&   : NULL
54--> http://www.php.net:80/?&   : NULL
55--> http://www.php.net:80/index.php?test=1&   : NULL
56--> http://www.php.net/index.php?&   : NULL
57--> http://www.php.net:80/index.php?foo&   : NULL
58--> http://www.php.net/index.php?&foo   : NULL
59--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI   : NULL
60--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123   : string(16) "some_page_ref123"
61--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123   : string(16) "some_page_ref123"
62--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123   : string(16) "some_page_ref123"
63--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123   : string(16) "some_page_ref123"
64--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123   : string(16) "some_page_ref123"
65--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123   : string(16) "some_page_ref123"
66--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123   : string(16) "some_page_ref123"
67--> nntp://news.php.net   : NULL
68--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz   : NULL
69--> zlib:http://foo@bar   : NULL
70--> zlib:filename.txt   : NULL
71--> zlib:/path/to/my/file/file.txt   : NULL
72--> foo://foo@bar   : NULL
73--> mailto:me@mydomain.com   : NULL
74--> /foo.php?a=b&c=d   : NULL
75--> foo.php?a=b&c=d   : NULL
76--> http://user:passwd@www.example.com:8080?bar=1&boom=0   : NULL
77--> http://user_me-you:my_pas-word@www.example.com:8080?bar=1&boom=0   : NULL
78--> file:///path/to/file   : NULL
79--> file://path/to/file   : NULL
80--> file:/path/to/file   : NULL
81--> http://1.2.3.4:/abc.asp?a=1&b=2   : NULL
82--> http://foo.com#bar   : string(3) "bar"
83--> scheme:   : NULL
84--> foo+bar://baz@bang/bla   : NULL
85--> gg:9130731   : NULL
86--> http://user:@pass@host/path?argument?value#etc   : string(3) "etc"
87--> http://10.10.10.10/:80   : NULL
88--> http://x:?   : NULL
89--> x:blah.com   : NULL
90--> x:/blah.com   : NULL
91--> x://::abc/?   : bool(false)
92--> http://::?   : NULL
93--> http://::#   : string(0) ""
94--> x://::6.5   : NULL
95--> http://?:/   : bool(false)
96--> http://@?:/   : bool(false)
97--> file:///:   : NULL
98--> file:///a:/   : NULL
99--> file:///ab:/   : NULL
100--> file:///a:/   : NULL
101--> file:///@:/   : NULL
102--> file:///:80/   : NULL
103--> []   : NULL
104--> http://[x:80]/   : NULL
105-->    : NULL
106--> /   : NULL
107--> /rest/Users?filter={"id":"123"}   : NULL
108--> %:x   : NULL
109--> https://example.com:0/   : NULL
110--> http:///blah.com   : bool(false)
111--> http://:80   : bool(false)
112--> http://user@:80   : bool(false)
113--> http://user:pass@:80   : bool(false)
114--> http://:   : bool(false)
115--> http://@/   : bool(false)
116--> http://@:/   : bool(false)
117--> http://:/   : bool(false)
118--> http://?   : bool(false)
119--> http://#   : bool(false)
120--> http://?:   : bool(false)
121--> http://:?   : bool(false)
122--> http://blah.com:123456   : bool(false)
123--> http://blah.com:abcdef   : bool(false)
124Done
125