1
0
mirror of https://github.com/php/php-src.git synced 2026-03-30 04:02:19 +02:00
Files
archived-php-src/ext/standard/tests/math/base_convert_error.phpt
2019-06-05 14:53:50 +02:00

36 lines
827 B
PHP

--TEST--
Test base_convert() function : error conditions - incorrect input
--FILE--
<?php
/* Prototype : string base_convert ( string $number , int $frombase , int $tobase )
* Description: Convert a number between arbitrary bases.
* Source code: ext/standard/math.c
*/
echo "*** Testing base_convert() : error conditions ***\n";
// get a class
class classA
{
}
echo "Incorrect input\n";
base_convert(1234, 1, 10);
base_convert(1234, 10, 37);
try {
base_convert(new classA(), 8, 10);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
*** Testing base_convert() : error conditions ***
Incorrect input
Warning: base_convert(): Invalid `from base' (1) in %s on line %d
Warning: base_convert(): Invalid `to base' (37) in %s on line %d
Object of class classA could not be converted to string