--TEST-- XMLWriter::toStream() - normal usage --EXTENSIONS-- xmlwriter --FILE-- startElement("root"); $writer->writeAttribute("align", "left"); $writer->writeComment("hello"); $writer->endElement(); $amount = $writer->flush(); echo "\nFlush amount: "; var_dump($amount); // Force destroying the held stream unset($writer); // Test that the stream wasn't closed or destroyed fwrite($h, "\nthis is the end\n"); ?> --EXPECT-- Flush amount: int(38) this is the end