mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
ce1d69a1f6
PHP requires integer typehints to be written "int" and does not allow "integer" as an alias. This changes type error messages to match the actual type name and avoids confusing messages like "must be of the type integer, integer given".
42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
--TEST--
|
|
IntlGregorianCalendar::__construct(): bad arguments
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('intl'))
|
|
die('skip intl extension not enabled');
|
|
--FILE--
|
|
<?php
|
|
ini_set("intl.error_level", E_WARNING);
|
|
|
|
function print_exception($e) {
|
|
echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
|
|
}
|
|
|
|
var_dump(intlgregcal_create_instance(1,2,3,4,5,6,7));
|
|
var_dump(intlgregcal_create_instance(1,2,3,4,5,6,7,8));
|
|
var_dump(intlgregcal_create_instance(1,2,3,4));
|
|
try {
|
|
var_dump(new IntlGregorianCalendar(1,2,NULL,4));
|
|
} catch (IntlException $e) {
|
|
print_exception($e);
|
|
}
|
|
try {
|
|
var_dump(new IntlGregorianCalendar(1,2,3,4,NULL,array()));
|
|
} catch (TypeError $e) {
|
|
print_exception($e);
|
|
}
|
|
--EXPECTF--
|
|
|
|
Warning: intlgregcal_create_instance(): intlgregcal_create_instance: too many arguments in %s on line %d
|
|
NULL
|
|
|
|
Warning: intlgregcal_create_instance(): intlgregcal_create_instance: too many arguments in %s on line %d
|
|
NULL
|
|
|
|
Warning: intlgregcal_create_instance(): intlgregcal_create_instance: no variant with 4 arguments (excluding trailing NULLs) in %s on line %d
|
|
NULL
|
|
|
|
Exception: IntlGregorianCalendar::__construct(): intlgregcal_create_instance: no variant with 4 arguments (excluding trailing NULLs) in %s on line %d
|
|
|
|
Exception: IntlGregorianCalendar::__construct() expects parameter 6 to be int, array given in %s on line %d
|