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-- basename bug #66395 check drive traversing and NTFS streams --SKIPIF-- <?php if (..

Decoded Output download

--TEST--
basename bug #66395 check drive traversing and NTFS streams
--SKIPIF--
<?php if (substr(PHP_OS, 0, 3) != 'WIN') { die('skip Windows only basename tests'); } ?>
--FILE--
<?php
echo basename("y:") . "
";
echo basename("y:/") . "
";
echo basename("notdriveletter:file.txt") . "
";
echo basename("a:\b:c:d:hello.txt\hcd:c.txt") . "
";
echo basename("a:b:c:d:hello.txt\d:some.txt") . "
";
echo basename("a:b:c:d:hello\world.bmp\c:d:e:f.txt") . "
";
echo basename("a:\b:\c:d:hello\world\a.bmp\d:e:f:g.txt") . "
";
echo basename("a:\b:\c:d:hello/world\a.bmp\d:\e:\f:g.txt") . "
";
echo basename("a:\b:/c:d:hello\world:somestream") . "
";
echo basename("a:\b:\c:d:hello\world:some.stream") . "
";
echo basename("a:/b:\c:d:hello\world:some.stream:\$DATA") . "
";
echo basename("x:y:z:hello\world:my.stream:\$DATA") . "
";
echo basename("a:\b:\c:d:hello\world:c:\$DATA") . "
";
echo basename("a:\b:\c:d:hello\d:world:c:\$DATA") . "
";
?>
--EXPECT--
y
y
notdriveletter:file.txt
hcd:c.txt
some.txt
f.txt
g.txt
g.txt
world:somestream
world:some.stream
world:some.stream:$DATA
world:my.stream:$DATA
world:c:$DATA
world:c:$DATA

Did this file decode correctly?

Original Code

--TEST--
basename bug #66395 check drive traversing and NTFS streams
--SKIPIF--
<?php if (substr(PHP_OS, 0, 3) != 'WIN') { die('skip Windows only basename tests'); } ?>
--FILE--
<?php
echo basename("y:") . "\n";
echo basename("y:/") . "\n";
echo basename("notdriveletter:file.txt") . "\n";
echo basename("a:\\b:c:d:hello.txt\\hcd:c.txt") . "\n";
echo basename("a:b:c:d:hello.txt\\d:some.txt") . "\n";
echo basename("a:b:c:d:hello\world\a.bmp\c:d:e:f.txt") . "\n";
echo basename("a:\\b:\\c:d:hello\\world\\a.bmp\\d:e:f:g.txt") . "\n";
echo basename("a:\\b:\\c:d:hello/world\\a.bmp\\d:\\e:\\f:g.txt") . "\n";
echo basename("a:\\b:/c:d:hello\\world:somestream") . "\n";
echo basename("a:\\b:\\c:d:hello\\world:some.stream") . "\n";
echo basename("a:/b:\\c:d:hello\\world:some.stream:\$DATA") . "\n";
echo basename("x:y:z:hello\world:my.stream:\$DATA") . "\n";
echo basename("a:\\b:\\c:d:hello\\world:c:\$DATA") . "\n";
echo basename("a:\\b:\\c:d:hello\\d:world:c:\$DATA") . "\n";
?>
--EXPECT--
y
y
notdriveletter:file.txt
hcd:c.txt
some.txt
f.txt
g.txt
g.txt
world:somestream
world:some.stream
world:some.stream:$DATA
world:my.stream:$DATA
world:c:$DATA
world:c:$DATA

Function Calls

None

Variables

None

Stats

MD5 26a2c8ea957ea436a69e5aa4e3303fab
Eval Count 0
Decode Time 103 ms