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-- Test count() function : invalid modes in weak type mode --FILE-- <?php $modes = ..

Decoded Output download

--TEST--
Test count() function : invalid modes in weak type mode
--FILE--
<?php

$modes = [
    COUNT_NORMAL,
    COUNT_RECURSIVE,
    0,
    1,
    -1,
    2,
    TRUE,
    FALSE,
];

foreach ($modes as $mode) {
    try {
        var_dump(count([], $mode));
    } catch (\ValueError $error) {
        echo $error->getMessage() . \PHP_EOL;
    }
}
?>
--EXPECT--
int(0)
int(0)
int(0)
int(0)
count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE
count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE
int(0)
int(0)

Did this file decode correctly?

Original Code

--TEST--
Test count() function : invalid modes in weak type mode
--FILE--
<?php

$modes = [
    COUNT_NORMAL,
    COUNT_RECURSIVE,
    0,
    1,
    -1,
    2,
    TRUE,
    FALSE,
];

foreach ($modes as $mode) {
    try {
        var_dump(count([], $mode));
    } catch (\ValueError $error) {
        echo $error->getMessage() . \PHP_EOL;
    }
}
?>
--EXPECT--
int(0)
int(0)
int(0)
int(0)
count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE
count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE
int(0)
int(0)

Function Calls

None

Variables

None

Stats

MD5 3d039aed402a65381cb2cab26f4bc564
Eval Count 0
Decode Time 83 ms