php-src/ext/spl/tests/fixedarray_005.phpt

29 lines
695 B
Plaintext
Raw Normal View History

--TEST--
SPL: FixedArray: Invalid arguments
--FILE--
<?php
2015-03-01 21:44:55 +08:00
try {
2020-02-04 05:52:20 +08:00
$a = new SplFixedArray(new stdClass);
} catch (TypeError $iae) {
2020-02-04 05:52:20 +08:00
echo "Ok - ".$iae->getMessage().PHP_EOL;
2015-03-01 21:44:55 +08:00
}
try {
2020-02-04 05:52:20 +08:00
$a = new SplFixedArray('FOO');
} catch (TypeError $iae) {
2020-02-04 05:52:20 +08:00
echo "Ok - ".$iae->getMessage().PHP_EOL;
2015-03-01 21:44:55 +08:00
}
try {
2020-02-04 05:52:20 +08:00
$a = new SplFixedArray('');
} catch (TypeError $iae) {
2020-02-04 05:52:20 +08:00
echo "Ok - ".$iae->getMessage().PHP_EOL;
}
?>
--EXPECT--
Ok - SplFixedArray::__construct(): Argument #1 ($size) must be of type int, stdClass given
Ok - SplFixedArray::__construct(): Argument #1 ($size) must be of type int, string given
Ok - SplFixedArray::__construct(): Argument #1 ($size) must be of type int, string given