1--TEST-- 2Test parse_url() function: url component specifier out of range 3--FILE-- 4<?php 5echo "*** Testing parse_url() : error conditions: url component specifier out of range ***\n"; 6$url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123'; 7 8echo "--> Below range:"; 9var_dump(parse_url($url, -1)); 10 11echo "\n\n--> Above range:\n"; 12try { 13 parse_url($url, 99); 14} catch (ValueError $exception) { 15 echo $exception->getMessage() . "\n"; 16} 17 18echo "Done" 19?> 20--EXPECT-- 21*** Testing parse_url() : error conditions: url component specifier out of range *** 22--> Below range:array(8) { 23 ["scheme"]=> 24 string(4) "http" 25 ["host"]=> 26 string(11) "www.php.net" 27 ["port"]=> 28 int(80) 29 ["user"]=> 30 string(6) "secret" 31 ["pass"]=> 32 string(7) "hideout" 33 ["path"]=> 34 string(10) "/index.php" 35 ["query"]=> 36 string(31) "test=1&test2=char&test3=mixesCI" 37 ["fragment"]=> 38 string(16) "some_page_ref123" 39} 40 41 42--> Above range: 43parse_url(): Argument #2 ($component) must be a valid URL component identifier, 99 given 44Done 45