xref: /PHP-8.0/ext/spl/tests/fixedarray_005.phpt (revision fbe30592)
1--TEST--
2SPL: FixedArray: Invalid arguments
3--FILE--
4<?php
5
6try {
7    $a = new SplFixedArray(new stdClass);
8} catch (TypeError $iae) {
9    echo "Ok - ".$iae->getMessage().PHP_EOL;
10}
11
12try {
13    $a = new SplFixedArray('FOO');
14} catch (TypeError $iae) {
15    echo "Ok - ".$iae->getMessage().PHP_EOL;
16}
17
18try {
19    $a = new SplFixedArray('');
20} catch (TypeError $iae) {
21    echo "Ok - ".$iae->getMessage().PHP_EOL;
22}
23
24?>
25--EXPECT--
26Ok - SplFixedArray::__construct(): Argument #1 ($size) must be of type int, stdClass given
27Ok - SplFixedArray::__construct(): Argument #1 ($size) must be of type int, string given
28Ok - SplFixedArray::__construct(): Argument #1 ($size) must be of type int, string given
29