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-- Bug #70561 (DirectoryIterator::seek should throw OutOfBoundsException) --FILE-- <..

Decoded Output download

--TEST--
Bug #70561 (DirectoryIterator::seek should throw OutOfBoundsException)
--FILE--
<?php
$di = new DirectoryIterator(__DIR__ . '/..');

$cnt = 0;
$di->rewind();
while ($di->valid()) {
    $cnt++;
    $di->next();
}

try {
    $di->seek($cnt+1);
} catch (OutOfBoundsException $ex) {
    echo $ex->getMessage() . PHP_EOL;
}
echo "Is valid? " . (int) $di->valid() . PHP_EOL;
?>
--EXPECTF--
Seek position %d is out of range
Is valid? 0

Did this file decode correctly?

Original Code

--TEST--
Bug #70561 (DirectoryIterator::seek should throw OutOfBoundsException)
--FILE--
<?php
$di = new DirectoryIterator(__DIR__ . '/..');

$cnt = 0;
$di->rewind();
while ($di->valid()) {
    $cnt++;
    $di->next();
}

try {
    $di->seek($cnt+1);
} catch (OutOfBoundsException $ex) {
    echo $ex->getMessage() . PHP_EOL;
}
echo "Is valid? " . (int) $di->valid() . PHP_EOL;
?>
--EXPECTF--
Seek position %d is out of range
Is valid? 0

Function Calls

None

Variables

None

Stats

MD5 65a978a848cd2ee1fd4c4712917fd1a6
Eval Count 0
Decode Time 100 ms