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 readlink() function: usage variations - invalid filenames --CREDITS-- Dave K..
Decoded Output download
--TEST--
Test readlink() function: usage variations - invalid filenames
--CREDITS--
Dave Kelsey <[email protected]>
--CONFLICTS--
obscure_filename
--FILE--
<?php
/* Testing readlink() with invalid arguments -int, float, bool, NULL, resource */
$file_path = __DIR__;
echo "*** Testing Invalid file types ***
";
$filenames = array(
/* Invalid filenames */
-2.34555,
"",
TRUE,
FALSE,
/* scalars */
1234,
0
);
/* loop through to test each element the above array */
foreach( $filenames as $filename ) {
var_dump( readlink($filename) );
clearstatcache();
}
?>
--CLEAN--
<?php
$file_path = __DIR__;
unlink($file_path."/readlink_variation2.tmp");
?>
--EXPECTF--
*** Testing Invalid file types ***
Warning: readlink(): %s in %s on line %d
bool(false)
Warning: readlink(): %s in %s on line %d
bool(false)
Warning: readlink(): %s in %s on line %d
bool(false)
Warning: readlink(): %s in %s on line %d
bool(false)
Warning: readlink(): %s in %s on line %d
bool(false)
Warning: readlink(): %s in %s on line %d
bool(false)
Did this file decode correctly?
Original Code
--TEST--
Test readlink() function: usage variations - invalid filenames
--CREDITS--
Dave Kelsey <[email protected]>
--CONFLICTS--
obscure_filename
--FILE--
<?php
/* Testing readlink() with invalid arguments -int, float, bool, NULL, resource */
$file_path = __DIR__;
echo "*** Testing Invalid file types ***\n";
$filenames = array(
/* Invalid filenames */
-2.34555,
"",
TRUE,
FALSE,
/* scalars */
1234,
0
);
/* loop through to test each element the above array */
foreach( $filenames as $filename ) {
var_dump( readlink($filename) );
clearstatcache();
}
?>
--CLEAN--
<?php
$file_path = __DIR__;
unlink($file_path."/readlink_variation2.tmp");
?>
--EXPECTF--
*** Testing Invalid file types ***
Warning: readlink(): %s in %s on line %d
bool(false)
Warning: readlink(): %s in %s on line %d
bool(false)
Warning: readlink(): %s in %s on line %d
bool(false)
Warning: readlink(): %s in %s on line %d
bool(false)
Warning: readlink(): %s in %s on line %d
bool(false)
Warning: readlink(): %s in %s on line %d
bool(false)
Function Calls
None |
Stats
MD5 | a4013d280e8968cc0bd0a38e50467c98 |
Eval Count | 0 |
Decode Time | 92 ms |