xref: /PHP-7.3/ext/dom/tests/bug42082.phpt (revision ded3d984)
1--TEST--
2Bug #42082 (NodeList length zero should be empty)
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7$doc = new DOMDocument();
8$xpath = new DOMXPath($doc);
9$nodes = $xpath->query('*');
10echo get_class($nodes), "\n";
11var_dump($nodes->length);
12$length = $nodes->length;
13var_dump(empty($nodes->length), empty($length));
14
15$doc->loadXML("<element></element>");
16var_dump($doc->firstChild->nodeValue, empty($doc->firstChild->nodeValue), isset($doc->firstChild->nodeValue));
17var_dump(empty($doc->nodeType), empty($doc->firstChild->nodeType))
18?>
19===DONE===
20--EXPECT--
21DOMNodeList
22int(0)
23bool(true)
24bool(true)
25string(0) ""
26bool(true)
27bool(true)
28bool(false)
29bool(false)
30===DONE===
31
32