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 #32993 (implemented Iterator function current() don't throw exception) --FILE..

Decoded Output download

--TEST--
Bug #32993 (implemented Iterator function current() don't throw exception)
--FILE--
<?php
class Test implements Iterator {

    public $arr = array();

    public function rewind(): void    { reset($this->arr); }
    public function current(): mixed   { throw new Exception(); }
    public function key(): mixed       { return key($this->arr); }
    public function next(): void      { next($this->arr); }
    public function valid(): bool     { return (current($this->arr) !== false); }
}

$t = new Test();
$t->arr =  array(1, 2, 3);

try {
    foreach ($t as $v) {
        echo "$v
";
    }
} catch (Exception $e) {
    ; // handle exception
}
echo "ok
";
?>
--EXPECT--
ok

Did this file decode correctly?

Original Code

--TEST--
Bug #32993 (implemented Iterator function current() don't throw exception)
--FILE--
<?php
class Test implements Iterator {

    public $arr = array();

    public function rewind(): void    { reset($this->arr); }
    public function current(): mixed   { throw new Exception(); }
    public function key(): mixed       { return key($this->arr); }
    public function next(): void      { next($this->arr); }
    public function valid(): bool     { return (current($this->arr) !== false); }
}

$t = new Test();
$t->arr =  array(1, 2, 3);

try {
    foreach ($t as $v) {
        echo "$v\n";
    }
} catch (Exception $e) {
    ; // handle exception
}
echo "ok\n";
?>
--EXPECT--
ok

Function Calls

None

Variables

None

Stats

MD5 7a4581da63d2f0b49cd571b70bdd1854
Eval Count 0
Decode Time 89 ms