1--TEST--
2XMLReader::fromStream() - custom constructor with error
3--EXTENSIONS--
4xmlreader
5--FILE--
6<?php
7class CustomXMLReader extends XMLReader {
8    public function __construct() {
9        throw new Error('nope');
10    }
11}
12
13$h = fopen("php://memory", "w+");
14fwrite($h, "<root/>");
15fseek($h, 0);
16
17try {
18    CustomXMLReader::fromStream($h, encoding: "UTF-8");
19} catch (Throwable $e) {
20    echo $e->getMessage(), "\n";
21}
22
23fclose($h);
24?>
25--EXPECT--
26nope
27