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-- SPL: DirectoryIterator defaults --SKIPIF-- <?php if (!defined('GLOB_ERR')) die('s..
Decoded Output download
--TEST--
SPL: DirectoryIterator defaults
--SKIPIF--
<?php if (!defined('GLOB_ERR')) die('skip GLOB_ERR not defined'); ?>
--FILE--
<?php
$classes = array(
'DirectoryIterator' => 0,
'FilesystemIterator' => 1,
'RecursiveDirectoryIterator' => 1,
'GlobIterator' => 1,
);
foreach ($classes as $class => $flags) {
echo "===$class===
";
$ref = new ReflectionClass($class);
$obj = $ref->newInstance('glob://*');
echo get_class($obj->current()) . "
";
if ($flags)
{
var_dump($obj->getFlags());
$flags = array(
FilesystemIterator::CURRENT_AS_FILEINFO => 0,
FilesystemIterator::CURRENT_AS_SELF => 0,
FilesystemIterator::CURRENT_AS_PATHNAME => 1,
);
foreach($flags as $flag => $isstring) {
$obj->setFlags($flag);
$obj->rewind();
var_dump($obj->getFlags());
if ($isstring) {
$val = $obj->current();
if (is_string($val)) {
var_dump(true);
} else {
var_dump($val);
}
} else {
echo get_class($obj->current()) . "
";
}
}
}
}
?>
--EXPECTF--
===DirectoryIterator===
DirectoryIterator
===FilesystemIterator===
SplFileInfo
int(%d)
int(0)
SplFileInfo
int(16)
FilesystemIterator
int(32)
bool(true)
===RecursiveDirectoryIterator===
SplFileInfo
int(0)
int(0)
SplFileInfo
int(16)
RecursiveDirectoryIterator
int(32)
bool(true)
===GlobIterator===
SplFileInfo
int(0)
int(0)
SplFileInfo
int(16)
GlobIterator
int(32)
bool(true)
Did this file decode correctly?
Original Code
--TEST--
SPL: DirectoryIterator defaults
--SKIPIF--
<?php if (!defined('GLOB_ERR')) die('skip GLOB_ERR not defined'); ?>
--FILE--
<?php
$classes = array(
'DirectoryIterator' => 0,
'FilesystemIterator' => 1,
'RecursiveDirectoryIterator' => 1,
'GlobIterator' => 1,
);
foreach ($classes as $class => $flags) {
echo "===$class===\n";
$ref = new ReflectionClass($class);
$obj = $ref->newInstance('glob://*');
echo get_class($obj->current()) . "\n";
if ($flags)
{
var_dump($obj->getFlags());
$flags = array(
FilesystemIterator::CURRENT_AS_FILEINFO => 0,
FilesystemIterator::CURRENT_AS_SELF => 0,
FilesystemIterator::CURRENT_AS_PATHNAME => 1,
);
foreach($flags as $flag => $isstring) {
$obj->setFlags($flag);
$obj->rewind();
var_dump($obj->getFlags());
if ($isstring) {
$val = $obj->current();
if (is_string($val)) {
var_dump(true);
} else {
var_dump($val);
}
} else {
echo get_class($obj->current()) . "\n";
}
}
}
}
?>
--EXPECTF--
===DirectoryIterator===
DirectoryIterator
===FilesystemIterator===
SplFileInfo
int(%d)
int(0)
SplFileInfo
int(16)
FilesystemIterator
int(32)
bool(true)
===RecursiveDirectoryIterator===
SplFileInfo
int(0)
int(0)
SplFileInfo
int(16)
RecursiveDirectoryIterator
int(32)
bool(true)
===GlobIterator===
SplFileInfo
int(0)
int(0)
SplFileInfo
int(16)
GlobIterator
int(32)
bool(true)
Function Calls
defined | 1 |
Stats
MD5 | fc0f83729f98d5b0ab9e1eca03e96c83 |
Eval Count | 0 |
Decode Time | 95 ms |