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-- GH-11338 (SplFileInfo empty getBasename with more than on slash) --FILE-- <?php ..
Decoded Output download
Testing: '/dir/anotherdir/basedir//'
Did this file decode correctly?
Original Code
--TEST--
GH-11338 (SplFileInfo empty getBasename with more than on slash)
--FILE--
<?php
function test($path) {
echo "Testing: '$path'\n";
$file = new \SplFileInfo($path);
var_dump($file->getBasename());
var_dump($file->getFilename());
}
test('/dir/anotherdir/basedir//');
test('/dir/anotherdir/basedir/');
test('/dir/anotherdir/basedir');
test('/dir/anotherdir//basedir');
test('///');
test('//');
test('/');
test('');
?>
--EXPECT--
Testing: '/dir/anotherdir/basedir//'
string(7) "basedir"
string(7) "basedir"
Testing: '/dir/anotherdir/basedir/'
string(7) "basedir"
string(7) "basedir"
Testing: '/dir/anotherdir/basedir'
string(7) "basedir"
string(7) "basedir"
Testing: '/dir/anotherdir//basedir'
string(7) "basedir"
string(7) "basedir"
Testing: '///'
string(0) ""
string(1) "/"
Testing: '//'
string(0) ""
string(1) "/"
Testing: '/'
string(0) ""
string(1) "/"
Testing: ''
string(0) ""
string(0) ""
Function Calls
test | 1 |
Stats
MD5 | d51c415a8305d85d156ce8f56de765e5 |
Eval Count | 0 |
Decode Time | 87 ms |