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 base_convert() function : error conditions - incorrect input --FILE-- <?php..

Decoded Output download

*** Testing base_convert() : error conditions ***

Did this file decode correctly?

Original Code

--TEST--
Test base_convert() function :  error conditions - incorrect input
--FILE--
<?php
echo "*** Testing base_convert() : error conditions ***\n";

// get a class
class classA
{
}

try {
    base_convert(1234, 1, 10);
} catch (ValueError $e) {
    echo $e->getMessage(), "\n";
}
try {
    base_convert(1234, 10, 37);
} catch (ValueError $e) {
    echo $e->getMessage(), "\n";
}

try {
    base_convert(new classA(), 8, 10);
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}

?>
--EXPECT--
*** Testing base_convert() : error conditions ***
base_convert(): Argument #2 ($from_base) must be between 2 and 36 (inclusive)
base_convert(): Argument #3 ($to_base) must be between 2 and 36 (inclusive)
base_convert(): Argument #1 ($num) must be of type string, classA given

Function Calls

None

Variables

None

Stats

MD5 5d42dff412ba242bb6fb4e00977d7367
Eval Count 0
Decode Time 88 ms