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-- Tests iterator_to_array() with non-scalar keys --FILE-- <?php function gen() { ..

Decoded Output download

--TEST--
Tests iterator_to_array() with non-scalar keys
--FILE--
<?php

function gen() {
    yield "foo" => 0;
    yield 1     => 1;
    yield 2.5   => 2;
    yield null  => 3;
    yield []    => 4;
    yield new stdClass => 5;
}

try {
    var_dump(iterator_to_array(gen()));
} catch (Error $e) {
    echo $e->getMessage(), "
";
}

?>
--EXPECTF--
Deprecated: Implicit conversion from float 2.5 to int loses precision in %s on line %d
Illegal offset type

Did this file decode correctly?

Original Code

--TEST--
Tests iterator_to_array() with non-scalar keys
--FILE--
<?php

function gen() {
    yield "foo" => 0;
    yield 1     => 1;
    yield 2.5   => 2;
    yield null  => 3;
    yield []    => 4;
    yield new stdClass => 5;
}

try {
    var_dump(iterator_to_array(gen()));
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}

?>
--EXPECTF--
Deprecated: Implicit conversion from float 2.5 to int loses precision in %s on line %d
Illegal offset type

Function Calls

None

Variables

None

Stats

MD5 3401a2a389302e39a218a53c418709f6
Eval Count 0
Decode Time 114 ms