1--TEST--
2XMLReader::fromUri() - 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
13try {
14    CustomXMLReader::fromUri("nonexistent");
15} catch (Throwable $e) {
16    echo $e->getMessage(), "\n";
17}
18
19$filename = __DIR__ . '/_fromUri_custom_constructor_error.xml';
20$xmlstring = '<?xml version="1.0" encoding="UTF-8"?>
21<books></books>';
22file_put_contents($filename, $xmlstring);
23
24try {
25    CustomXMLReader::fromUri($filename);
26} catch (Throwable $e) {
27    echo $e->getMessage(), "\n";
28}
29?>
30--EXPECT--
31Unable to open source data
32nope
33--CLEAN--
34<?php
35@unlink(__DIR__ . '/_fromUri_custom_constructor_error.xml');
36?>
37