forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayObject_illegal_offset.phpt
More file actions
39 lines (37 loc) · 945 Bytes
/
Copy pathArrayObject_illegal_offset.phpt
File metadata and controls
39 lines (37 loc) · 945 Bytes
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::class, ': ', $e->getMessage(), "\n";
}
try {
$ao[[]] = new stdClass;
} catch (TypeError $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$ref =& $ao[[]];
} catch (TypeError $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(isset($ao[[]]));
} catch (TypeError $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
unset($ao[[]]);
} catch (TypeError $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
TypeError: Cannot access offset of type array on ArrayObject
TypeError: Cannot access offset of type array on ArrayObject
TypeError: Cannot access offset of type array on ArrayObject
TypeError: Cannot access offset of type array in isset or empty
TypeError: Cannot unset offset of type array on ArrayObject