xref: /PHP-8.0/ext/dom/tests/bug42082.phpt (revision a555cc0b)
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--EXPECT--
20DOMNodeList
21int(0)
22bool(true)
23bool(true)
24string(0) ""
25bool(true)
26bool(true)
27bool(false)
28bool(false)
29