summaryrefslogtreecommitdiff
path: root/ext/dom/tests/bug67949.phpt
diff options
context:
space:
mode:
authorFlorian MARGAINE <florian@margaine.com>2014-09-26 18:25:56 +0200
committerFlorian MARGAINE <florian@margaine.com>2014-09-27 01:27:46 +0200
commit9469db93110b2185f019da0dd66d3537c1a4b7a4 (patch)
tree3d985dfe2f33cc4fe411cb3cd2f7ced007e6a90b /ext/dom/tests/bug67949.phpt
parent71c39612d5702920dfd198b37254b8bb06454b47 (diff)
downloadphp-git-9469db93110b2185f019da0dd66d3537c1a4b7a4.tar.gz
DOMNodeList elements are accessible through array notation
Fixes #67949
Diffstat (limited to 'ext/dom/tests/bug67949.phpt')
-rw-r--r--ext/dom/tests/bug67949.phpt20
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/dom/tests/bug67949.phpt b/ext/dom/tests/bug67949.phpt
new file mode 100644
index 0000000000..b12dc81d1d
--- /dev/null
+++ b/ext/dom/tests/bug67949.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #67949: DOMNodeList elements should be accessible through array notation
+--FILE--
+<?php
+
+$html = <<<HTML
+<div>data</div>
+HTML;
+$doc = new DOMDocument;
+$doc->loadHTML($html);
+var_dump($doc->getElementsByTagName('div')[0]->textContent);
+var_dump($doc->getElementsByTagName('div')['test']->textContent); // testing that weak casting works
+var_dump(isset($doc->getElementsByTagName('div')[0]));
+var_dump(isset($doc->getElementsByTagName('div')[1]));
+
+--EXPECT--
+string(4) "data"
+string(4) "data"
+bool(true)
+bool(false)