1--TEST--
2XMLWriter::toStream() - custom constructor
3--EXTENSIONS--
4xmlwriter
5--FILE--
6<?php
7
8class CustomXMLWriter extends XMLWriter {
9    public int $myField;
10
11    public function __construct() {
12        $this->myField = 1234;
13        echo "hello world\n";
14    }
15}
16
17$h = fopen("php://output", "w");
18
19$writer = CustomXMLWriter::toStream($h);
20var_dump($writer);
21$writer->startElement("root");
22$writer->endElement();
23$writer->flush();
24
25?>
26--EXPECTF--
27hello world
28object(CustomXMLWriter)#%d (1) {
29  ["myField"]=>
30  int(1234)
31}
32<root/>
33