We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2aebca8 commit bccd924Copy full SHA for bccd924
ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt
@@ -0,0 +1,29 @@
1
+--TEST--
2
+Test edge case offsets in DOMNamedNodeMap
3
+--EXTENSIONS--
4
+dom
5
+--FILE--
6
+<?php
7
+
8
+$document = new DomDocument();
9
+$root = $document->createElement('root');
10
+$document->appendChild($root);
11
+$root->setAttribute('attrib', 'value');
12
+var_dump($root->attributes->length);
13
+// Consistent with the method call
14
+try {
15
+ var_dump($root->attributes[-1]);
16
+} catch (ValueError $e) {
17
+ echo $e->getMessage(), "\n";
18
+}
19
20
+ $root->attributes[][] = null;
21
+} catch (Throwable $e) {
22
23
24
25
+?>
26
+--EXPECT--
27
+int(1)
28
+must be between 0 and 2147483647
29
+Cannot access DOMNamedNodeMap without offset
0 commit comments