mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Add edge-case testcase for offset in DOMNamedNodeMap
This commit is contained in:
parent
2aebca899c
commit
bccd924e3f
1 changed files with 29 additions and 0 deletions
29
ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt
Normal file
29
ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
--TEST--
|
||||||
|
Test edge case offsets in DOMNamedNodeMap
|
||||||
|
--EXTENSIONS--
|
||||||
|
dom
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$document = new DomDocument();
|
||||||
|
$root = $document->createElement('root');
|
||||||
|
$document->appendChild($root);
|
||||||
|
$root->setAttribute('attrib', 'value');
|
||||||
|
var_dump($root->attributes->length);
|
||||||
|
// Consistent with the method call
|
||||||
|
try {
|
||||||
|
var_dump($root->attributes[-1]);
|
||||||
|
} catch (ValueError $e) {
|
||||||
|
echo $e->getMessage(), "\n";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$root->attributes[][] = null;
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
echo $e->getMessage(), "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
int(1)
|
||||||
|
must be between 0 and 2147483647
|
||||||
|
Cannot access DOMNamedNodeMap without offset
|
Loading…
Add table
Add a link
Reference in a new issue