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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
--TEST--
TokenList: dimensions error
--EXTENSIONS--
dom
--FILE--
<?php
$dom = DOM\XMLDocument::createFromString('<root class="A B C"/>');
$list = $dom->documentElement->classList;
$testOffsets = [
new stdClass,
[],
fopen("php://output", "w"),
];
foreach ($testOffsets as $offset) {
try {
$list[$offset];
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
isset($list[$offset]);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
empty($list[$offset]);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
}
try {
$list[][0] = 1;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Cannot access offset of type stdClass on Dom\TokenList
Cannot access offset of type stdClass in isset or empty
Cannot access offset of type stdClass in isset or empty
Cannot access offset of type array on Dom\TokenList
Cannot access offset of type array in isset or empty
Cannot access offset of type array in isset or empty
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Cannot append to Dom\TokenList
|