Req #63506 [Opn]: Adding openStream() method to XMLWriter
| From: | nielsdos@php.net | Date: | Sat, 29 Jun 2024 16:08:26 +0000 |
| Subject: | Req #63506 [Opn]: Adding openStream() method to XMLWriter | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-247182@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63506&edit=1
ID: 63506
Updated by: nielsdos@php.net
Reported by: evert at rooftopsolutions dot nl
Summary: Adding openStream() method to XMLWriter
Status: Open
Type: Feature/Change Request
Package: XML Writer
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
This is implemented in PHP-8.4-dev (as toStream()).
Previous Comments:
------------------------------------------------------------------------
[2012-11-13 18:26:55] evert at rooftopsolutions dot nl
Description:
------------
It would be extremely handy if, instead of supplying XMLWriter with a uri, we can give it a
writeable stream instead, as such;
$h = fopen('php://output','w');
$xw = new \XMLWriter();
$xw->openStream($h);
This way the XMLWriter does not have to be aware of an output uri.
In my applications (webservices) I simply work with out an output, and an input stream. Different
components write to the outputstream, and what they are writing comes from different sources.
Unittests often simply replace the outputstream with php://memory, or php://temp, so the application
output can get easily redirected.
Using openUri() I have to break this, which would kind of suck.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63506&edit=1