summaryrefslogtreecommitdiff
path: root/ext/spl/tests/ArrayObject_illegal_offset.phpt
blob: df25e4fa5e0faeea4324598e1dd7dc8d567a0476 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--TEST--
ArrayObject illegal offset
--FILE--
<?php

$ao = new ArrayObject([1, 2, 3]);
try {
    var_dump($ao[[]]);
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}
try {
    $ao[[]] = new stdClass;
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}
try {
    $ref =& $ao[[]];
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}
try {
    var_dump(isset($ao[[]]));
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}
try {
    unset($ao[[]]);
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}

?>
--EXPECT--
Illegal offset type
Illegal offset type
Illegal offset type
Illegal offset type in isset or empty
Illegal offset type in unset