1--TEST--
2Test parse_url() function: url component specifier out of range
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
11echo "*** Testing parse_url() : error conditions: url component specifier out of range ***\n";
12$url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123';
13
14echo "--> Below range:";
15var_dump(parse_url($url, -1));
16
17echo "\n\n--> Above range:";
18var_dump(parse_url($url, 99));
19
20echo "Done"
21?>
22--EXPECTF--
23*** Testing parse_url() : error conditions: url component specifier out of range ***
24--> Below range:array(8) {
25  ["scheme"]=>
26  string(4) "http"
27  ["host"]=>
28  string(11) "www.php.net"
29  ["port"]=>
30  int(80)
31  ["user"]=>
32  string(6) "secret"
33  ["pass"]=>
34  string(7) "hideout"
35  ["path"]=>
36  string(10) "/index.php"
37  ["query"]=>
38  string(31) "test=1&test2=char&test3=mixesCI"
39  ["fragment"]=>
40  string(16) "some_page_ref123"
41}
42
43
44--> Above range:
45Warning: parse_url(): Invalid URL component identifier 99 in %s on line 15
46bool(false)
47Done