1--TEST--
2TokenList: dimensions error
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = DOM\XMLDocument::createFromString('<root class="A B C"/>');
9$list = $dom->documentElement->classList;
10
11$testOffsets = [
12    new stdClass,
13    [],
14    fopen("php://output", "w"),
15];
16
17foreach ($testOffsets as $offset) {
18    try {
19        $list[$offset];
20    } catch (TypeError $e) {
21        echo $e->getMessage(), "\n";
22    }
23
24    try {
25        isset($list[$offset]);
26    } catch (TypeError $e) {
27        echo $e->getMessage(), "\n";
28    }
29
30    try {
31        empty($list[$offset]);
32    } catch (TypeError $e) {
33        echo $e->getMessage(), "\n";
34    }
35}
36
37try {
38    $list[][0] = 1;
39} catch (Error $e) {
40    echo $e->getMessage(), "\n";
41}
42
43?>
44--EXPECTF--
45Cannot access offset of type stdClass on Dom\TokenList
46Cannot access offset of type stdClass in isset or empty
47Cannot access offset of type stdClass in isset or empty
48Cannot access offset of type array on Dom\TokenList
49Cannot access offset of type array in isset or empty
50Cannot access offset of type array in isset or empty
51
52Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
53
54Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
55
56Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
57Cannot append to Dom\TokenList
58