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