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 readdir() function : basic functionality --SKIPIF-- <?php if (substr(PHP_OS,..
Decoded Output download
--TEST--
Test readdir() function : basic functionality
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
die("skip Valid only on Windows");
}
?>
--FILE--
<?php
/*
* Test basic functionality of readdir()
*/
echo "*** Testing readdir() : basic functionality ***
";
// include the file.inc for Function: function create_files()
chdir(__DIR__);
include(__DIR__."/../file/file.inc");
$path = __DIR__ . '/readdir_basic';
mkdir($path);
create_files($path, 3);
echo "
-- Call readdir() with \$path argument --
";
var_dump($dh = opendir($path));
$a = array();
while( FALSE !== ($file = readdir($dh)) ) {
$a[] = $file;
}
sort($a);
foreach($a as $file) {
var_dump($file);
}
echo "
-- Call readdir() without \$path argument --
";
var_dump($dh = opendir($path));
$a = array();
while( FALSE !== ( $file = readdir() ) ) {
$a[] = $file;
}
sort($a);
foreach($a as $file) {
var_dump($file);
}
delete_files($path, 3);
closedir($dh);
?>
--CLEAN--
<?php
$path = __DIR__ . '/readdir_basic';
rmdir($path);
?>
--EXPECTF--
*** Testing readdir() : basic functionality ***
-- Call readdir() with $path argument --
resource(%d) of type (stream)
string(1) "."
string(2) ".."
string(9) "file1.tmp"
string(9) "file2.tmp"
string(9) "file3.tmp"
-- Call readdir() without $path argument --
resource(%d) of type (stream)
string(1) "."
string(2) ".."
string(9) "file1.tmp"
string(9) "file2.tmp"
string(9) "file3.tmp"
Did this file decode correctly?
Original Code
--TEST--
Test readdir() function : basic functionality
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
die("skip Valid only on Windows");
}
?>
--FILE--
<?php
/*
* Test basic functionality of readdir()
*/
echo "*** Testing readdir() : basic functionality ***\n";
// include the file.inc for Function: function create_files()
chdir(__DIR__);
include(__DIR__."/../file/file.inc");
$path = __DIR__ . '/readdir_basic';
mkdir($path);
create_files($path, 3);
echo "\n-- Call readdir() with \$path argument --\n";
var_dump($dh = opendir($path));
$a = array();
while( FALSE !== ($file = readdir($dh)) ) {
$a[] = $file;
}
sort($a);
foreach($a as $file) {
var_dump($file);
}
echo "\n-- Call readdir() without \$path argument --\n";
var_dump($dh = opendir($path));
$a = array();
while( FALSE !== ( $file = readdir() ) ) {
$a[] = $file;
}
sort($a);
foreach($a as $file) {
var_dump($file);
}
delete_files($path, 3);
closedir($dh);
?>
--CLEAN--
<?php
$path = __DIR__ . '/readdir_basic';
rmdir($path);
?>
--EXPECTF--
*** Testing readdir() : basic functionality ***
-- Call readdir() with $path argument --
resource(%d) of type (stream)
string(1) "."
string(2) ".."
string(9) "file1.tmp"
string(9) "file2.tmp"
string(9) "file3.tmp"
-- Call readdir() without $path argument --
resource(%d) of type (stream)
string(1) "."
string(2) ".."
string(9) "file1.tmp"
string(9) "file2.tmp"
string(9) "file3.tmp"
Function Calls
None |
Stats
MD5 | 46456c087947f363f8c254e7eb1ff7e9 |
Eval Count | 0 |
Decode Time | 105 ms |