--TEST-- Test parse_url() function : usage variations - unexpected type for arg 2. --SKIPIF-- --FILE-- 'red', 'item' => 'pen'), // null data NULL, null, // boolean data true, false, TRUE, FALSE, // empty data "", '', // string data "string", 'string', // object data new stdclass(), // undefined data $undefined_var, // unset data $unset_var, ); // loop through each element of the array for url_component foreach($values as $value) { echo "\nArg value $value \n"; var_dump( parse_url($url, $value) ); }; echo "Done"; ?> --EXPECTF-- *** Testing parse_url() : usage variations *** Error: 8 - Undefined variable: undefined_var, %s(61) Error: 8 - Undefined variable: unset_var, %s(64) Arg value 10.5 Error: 2 - parse_url(): Invalid URL component identifier 10, %s(71) bool(false) Arg value -10.5 array(8) { ["scheme"]=> string(4) "http" ["host"]=> string(11) "www.php.net" ["port"]=> int(80) ["user"]=> string(6) "secret" ["pass"]=> string(7) "hideout" ["path"]=> string(10) "/index.php" ["query"]=> string(31) "test=1&test2=char&test3=mixesCI" ["fragment"]=> string(16) "some_page_ref123" } Arg value 101234567000 Error: 2 - parse_url(): Invalid URL component identifier %d, %s(71) bool(false) Arg value 1.07654321E-9 string(4) "http" Arg value 0.5 string(4) "http" Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) Arg value Array Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(71) NULL Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) Arg value Array Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(71) NULL Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) Arg value Array Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(71) NULL Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) Arg value Array Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(71) NULL Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) Arg value Array Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(71) NULL Arg value string(4) "http" Arg value string(4) "http" Arg value 1 string(11) "www.php.net" Arg value string(4) "http" Arg value 1 string(11) "www.php.net" Arg value string(4) "http" Arg value Error: 2 - parse_url() expects parameter 2 to be int, string given, %s(71) NULL Arg value Error: 2 - parse_url() expects parameter 2 to be int, string given, %s(71) NULL Arg value string Error: 2 - parse_url() expects parameter 2 to be int, string given, %s(71) NULL Arg value string Error: 2 - parse_url() expects parameter 2 to be int, string given, %s(71) NULL Error: 4096 - Object of class stdClass could not be converted to string, %s(70) Arg value Error: 2 - parse_url() expects parameter 2 to be int, object given, %s(71) NULL Arg value string(4) "http" Arg value string(4) "http" Done