xref: /PHP-8.2/ext/dom/tests/gh16316.phpt (revision 1d0fbdf4)
1--TEST--
2GH-16316 (DOMXPath breaks when not initialized properly)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8class Demo extends DOMXPath {
9    public function __construct() {}
10}
11
12$demo = new Demo;
13try {
14    var_dump($demo);
15} catch (DOMException $e) {
16    echo $e->getMessage(), "\n";
17}
18
19try {
20    var_dump($demo->document);
21} catch (DOMException $e) {
22    echo $e->getMessage(), "\n";
23}
24
25?>
26--EXPECT--
27object(Demo)#1 (1) {
28  ["registerNodeNamespaces"]=>
29  bool(true)
30}
31Invalid State Error
32Invalid State Error
33