xref: /PHP-5.3/ext/spl/tests/fixedarray_015.phpt (revision 0f5ddaf4)
1--TEST--
2SPL: FixedArray: accessing uninitialized array
3--FILE--
4<?php
5
6$a = new SplFixedArray('');
7
8try {
9	var_dump($a[1]);
10} catch (Exception $e) {
11	echo $e->getMessage(), "\n";
12}
13try {
14	$a[1] = 1;
15} catch (Exception $e) {
16	echo $e->getMessage(), "\n";
17}
18try {
19	var_dump(count($a[1]));
20} catch (Exception $e) {
21	echo $e->getMessage(), "\n";
22}
23try {
24	var_dump($a->getSize());
25} catch (Exception $e) {
26	echo $e->getMessage(), "\n";
27}
28try {
29	foreach ($a as $v) {
30	}
31} catch (Exception $e) {
32	echo $e->getMessage(), "\n";
33}
34try {
35	var_dump($a->setSize(10));
36} catch (Exception $e) {
37	echo $e->getMessage(), "\n";
38}
39
40echo "Done\n";
41?>
42--EXPECTF--
43Warning: SplFixedArray::__construct() expects parameter 1 to be long, string given in %s on line %d
44Index invalid or out of range
45Index invalid or out of range
46Index invalid or out of range
47int(0)
48bool(true)
49Done
50