1--TEST--
2XMLReader::fromUri() - custom constructor
3--EXTENSIONS--
4xmlreader
5--FILE--
6<?php
7class CustomXMLReader extends XMLReader {
8    public int $myField;
9
10    public function __construct() {
11        $this->myField = 1234;
12        echo "hello world\n";
13    }
14}
15
16$filename = __DIR__ . '/_fromUri_custom_constructor.xml';
17$xmlstring = '<?xml version="1.0" encoding="UTF-8"?>
18<books></books>';
19file_put_contents($filename, $xmlstring);
20
21$reader = XMLReader::fromUri($filename);
22
23// Only go through
24while ($reader->read()) {
25    echo $reader->name."\n";
26}
27$reader->close();
28
29?>
30--EXPECT--
31books
32books
33--CLEAN--
34<?php
35@unlink(__DIR__ . '/_fromUri_custom_constructor.xml');
36?>
37