Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- Test parse_url() function: Parse a load of URLs without specifying PHP_URL_USER a..
Decoded Output download
--TEST--
Test parse_url() function: Parse a load of URLs without specifying PHP_URL_USER as the URL component
--FILE--
<?php
/*
* Parse a load of URLs without specifying PHP_URL_USER as the URL component
*/
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
echo "--> $url : ";
var_dump(parse_url($url, PHP_URL_USER));
}
echo "Done";
?>
--EXPECT--
--> 64.246.30.37 : NULL
--> http://64.246.30.37 : NULL
--> http://64.246.30.37/ : NULL
--> 64.246.30.37/ : NULL
--> 64.246.30.37:80/ : NULL
--> php.net : NULL
--> php.net/ : NULL
--> http://php.net : NULL
--> http://php.net/ : NULL
--> www.php.net : NULL
--> www.php.net/ : NULL
--> http://www.php.net : NULL
--> http://www.php.net/ : NULL
--> www.php.net:80 : NULL
--> http://www.php.net:80 : NULL
--> http://www.php.net:80/ : NULL
--> http://www.php.net/index.php : NULL
--> www.php.net/? : NULL
--> www.php.net:80/? : NULL
--> http://www.php.net/? : NULL
--> http://www.php.net:80/? : NULL
--> http://www.php.net:80/index.php : NULL
--> http://www.php.net:80/foo/bar/index.php : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
--> http://www.php.net:80/this/../a/../deep/directory : NULL
--> http://www.php.net:80/this/../a/../deep/directory/ : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL
--> http://www.php.net:80/index.php : NULL
--> http://www.php.net:80/index.php? : NULL
--> http://www.php.net:80/#foo : NULL
--> http://www.php.net:80/?# : NULL
--> http://www.php.net:80/?test=1 : NULL
--> http://www.php.net/?test=1& : NULL
--> http://www.php.net:80/?& : NULL
--> http://www.php.net:80/index.php?test=1& : NULL
--> http://www.php.net/index.php?& : NULL
--> http://www.php.net:80/index.php?foo& : NULL
--> http://www.php.net/index.php?&foo : NULL
--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL
--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
--> http://[email protected]:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
--> http://:[email protected]:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(0) ""
--> http://secret:[email protected]/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
--> http://secret@[email protected]:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(14) "secret@hideout"
--> http://secret:hid:[email protected]:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
--> nntp://news.php.net : NULL
--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
--> zlib:http://foo@bar : NULL
--> zlib:filename.txt : NULL
--> zlib:/path/to/my/file/file.txt : NULL
--> foo://foo@bar : string(3) "foo"
--> mailto:[email protected] : NULL
--> /foo.php?a=b&c=d : NULL
--> foo.php?a=b&c=d : NULL
--> http://user:[email protected]:8080?bar=1&boom=0 : string(4) "user"
--> http://user_me-you:[email protected]:8080?bar=1&boom=0 : string(11) "user_me-you"
--> file:///path/to/file : NULL
--> file://path/to/file : NULL
--> file:/path/to/file : NULL
--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL
--> http://foo.com#bar : NULL
--> scheme: : NULL
--> foo+bar://baz@bang/bla : string(3) "baz"
--> gg:9130731 : NULL
--> http://user:@pass@host/path?argument?value#etc : string(4) "user"
--> http://10.10.10.10/:80 : NULL
--> http://x:? : NULL
--> x:blah.com : NULL
--> x:/blah.com : NULL
--> x://::abc/? : bool(false)
--> http://::? : NULL
--> http://::# : NULL
--> x://::6.5 : NULL
--> http://?:/ : bool(false)
--> http://@?:/ : bool(false)
--> file:///: : NULL
--> file:///a:/ : NULL
--> file:///ab:/ : NULL
--> file:///a:/ : NULL
--> file:///@:/ : NULL
--> file:///:80/ : NULL
--> [] : NULL
--> http://[x:80]/ : NULL
--> : NULL
--> / : NULL
--> /rest/Users?filter={"id":"123"} : NULL
--> %:x : NULL
--> https://example.com:0/ : NULL
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
--> http://user:pass@:80 : bool(false)
--> http://: : bool(false)
--> http://@/ : bool(false)
--> http://@:/ : bool(false)
--> http://:/ : bool(false)
--> http://? : bool(false)
--> http://# : bool(false)
--> http://?: : bool(false)
--> http://:? : bool(false)
--> http://blah.com:123456 : bool(false)
--> http://blah.com:abcdef : bool(false)
Done
Did this file decode correctly?
Original Code
--TEST--
Test parse_url() function: Parse a load of URLs without specifying PHP_URL_USER as the URL component
--FILE--
<?php
/*
* Parse a load of URLs without specifying PHP_URL_USER as the URL component
*/
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
echo "--> $url : ";
var_dump(parse_url($url, PHP_URL_USER));
}
echo "Done";
?>
--EXPECT--
--> 64.246.30.37 : NULL
--> http://64.246.30.37 : NULL
--> http://64.246.30.37/ : NULL
--> 64.246.30.37/ : NULL
--> 64.246.30.37:80/ : NULL
--> php.net : NULL
--> php.net/ : NULL
--> http://php.net : NULL
--> http://php.net/ : NULL
--> www.php.net : NULL
--> www.php.net/ : NULL
--> http://www.php.net : NULL
--> http://www.php.net/ : NULL
--> www.php.net:80 : NULL
--> http://www.php.net:80 : NULL
--> http://www.php.net:80/ : NULL
--> http://www.php.net/index.php : NULL
--> www.php.net/? : NULL
--> www.php.net:80/? : NULL
--> http://www.php.net/? : NULL
--> http://www.php.net:80/? : NULL
--> http://www.php.net:80/index.php : NULL
--> http://www.php.net:80/foo/bar/index.php : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
--> http://www.php.net:80/this/../a/../deep/directory : NULL
--> http://www.php.net:80/this/../a/../deep/directory/ : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL
--> http://www.php.net:80/index.php : NULL
--> http://www.php.net:80/index.php? : NULL
--> http://www.php.net:80/#foo : NULL
--> http://www.php.net:80/?# : NULL
--> http://www.php.net:80/?test=1 : NULL
--> http://www.php.net/?test=1& : NULL
--> http://www.php.net:80/?& : NULL
--> http://www.php.net:80/index.php?test=1& : NULL
--> http://www.php.net/index.php?& : NULL
--> http://www.php.net:80/index.php?foo& : NULL
--> http://www.php.net/index.php?&foo : NULL
--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL
--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
--> http://[email protected]:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
--> http://:[email protected]:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(0) ""
--> http://secret:[email protected]/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
--> http://secret@[email protected]:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(14) "secret@hideout"
--> http://secret:hid:[email protected]:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
--> nntp://news.php.net : NULL
--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
--> zlib:http://foo@bar : NULL
--> zlib:filename.txt : NULL
--> zlib:/path/to/my/file/file.txt : NULL
--> foo://foo@bar : string(3) "foo"
--> mailto:[email protected] : NULL
--> /foo.php?a=b&c=d : NULL
--> foo.php?a=b&c=d : NULL
--> http://user:[email protected]:8080?bar=1&boom=0 : string(4) "user"
--> http://user_me-you:[email protected]:8080?bar=1&boom=0 : string(11) "user_me-you"
--> file:///path/to/file : NULL
--> file://path/to/file : NULL
--> file:/path/to/file : NULL
--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL
--> http://foo.com#bar : NULL
--> scheme: : NULL
--> foo+bar://baz@bang/bla : string(3) "baz"
--> gg:9130731 : NULL
--> http://user:@pass@host/path?argument?value#etc : string(4) "user"
--> http://10.10.10.10/:80 : NULL
--> http://x:? : NULL
--> x:blah.com : NULL
--> x:/blah.com : NULL
--> x://::abc/? : bool(false)
--> http://::? : NULL
--> http://::# : NULL
--> x://::6.5 : NULL
--> http://?:/ : bool(false)
--> http://@?:/ : bool(false)
--> file:///: : NULL
--> file:///a:/ : NULL
--> file:///ab:/ : NULL
--> file:///a:/ : NULL
--> file:///@:/ : NULL
--> file:///:80/ : NULL
--> [] : NULL
--> http://[x:80]/ : NULL
--> : NULL
--> / : NULL
--> /rest/Users?filter={"id":"123"} : NULL
--> %:x : NULL
--> https://example.com:0/ : NULL
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
--> http://user:pass@:80 : bool(false)
--> http://: : bool(false)
--> http://@/ : bool(false)
--> http://@:/ : bool(false)
--> http://:/ : bool(false)
--> http://? : bool(false)
--> http://# : bool(false)
--> http://?: : bool(false)
--> http://:? : bool(false)
--> http://blah.com:123456 : bool(false)
--> http://blah.com:abcdef : bool(false)
Done
Function Calls
None |
Stats
MD5 | 5c6f1ace6a3c785d2ee6bb51b5219d0e |
Eval Count | 0 |
Decode Time | 88 ms |