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-- Only arrays and Traversables can be unpacked --FILE-- <?php function test(...$ar..

Decoded Output download

--TEST--
Only arrays and Traversables can be unpacked
--FILE--
<?php

function test(...$args) {
    var_dump($args);
}

try {
    test(...null);
} catch (Error $e) {
    echo $e->getMessage(), "
";
}
try {
    test(...42);
} catch (Error $e) {
    echo $e->getMessage(), "
";
}
try {
    test(...new stdClass);
} catch (Error $e) {
    echo $e->getMessage(), "
";
}

try {
    test(1, 2, 3, ..."foo", ...[4, 5]);
} catch (Error $e) {
    echo $e->getMessage(), "
";
}
try {
    test(1, 2, 3, ...new StdClass, ...3.14, ...[4, 5]);
} catch (Error $e) {
    echo $e->getMessage(), "
";
}

?>
--EXPECT--
Only arrays and Traversables can be unpacked
Only arrays and Traversables can be unpacked
Only arrays and Traversables can be unpacked
Only arrays and Traversables can be unpacked
Only arrays and Traversables can be unpacked

Did this file decode correctly?

Original Code

--TEST--
Only arrays and Traversables can be unpacked
--FILE--
<?php

function test(...$args) {
    var_dump($args);
}

try {
    test(...null);
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
try {
    test(...42);
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
try {
    test(...new stdClass);
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}

try {
    test(1, 2, 3, ..."foo", ...[4, 5]);
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
try {
    test(1, 2, 3, ...new StdClass, ...3.14, ...[4, 5]);
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}

?>
--EXPECT--
Only arrays and Traversables can be unpacked
Only arrays and Traversables can be unpacked
Only arrays and Traversables can be unpacked
Only arrays and Traversables can be unpacked
Only arrays and Traversables can be unpacked

Function Calls

None

Variables

None

Stats

MD5 df2c0a62f73db9546514759377ede5eb
Eval Count 0
Decode Time 97 ms