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 #30725 (PHP segfaults when an exception is thrown in getIterator() within for..

Decoded Output download

--TEST--
Bug #30725 (PHP segfaults when an exception is thrown in getIterator() within foreach)
--FILE--
<?php

class Test implements IteratorAggregate
{
    function getIterator(): Traversable
    {
        throw new Exception();
    }
}

try
{
    $it = new Test;
    foreach($it as $v)
    {
        echo "Fail
";
    }
    echo "Wrong
";
}
catch(Exception $e)
{
    echo "Caught
";
}

?>
--EXPECT--
Caught

Did this file decode correctly?

Original Code

--TEST--
Bug #30725 (PHP segfaults when an exception is thrown in getIterator() within foreach)
--FILE--
<?php

class Test implements IteratorAggregate
{
    function getIterator(): Traversable
    {
        throw new Exception();
    }
}

try
{
    $it = new Test;
    foreach($it as $v)
    {
        echo "Fail\n";
    }
    echo "Wrong\n";
}
catch(Exception $e)
{
    echo "Caught\n";
}

?>
--EXPECT--
Caught

Function Calls

None

Variables

None

Stats

MD5 c6280e92d8082efdcf814728baae7ae6
Eval Count 0
Decode Time 115 ms