Bug #79344 [NEW]: XmlWriter::writeAttributeNS produces bad XML with null prefix
| From: | jtojnar at gmail dot com | Date: | Wed, 04 Mar 2020 16:38:53 +0000 |
| Subject: | Bug #79344 [NEW]: XmlWriter::writeAttributeNS produces bad XML with null prefix | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-225885@lists.php.net to get a copy of this message | ||
From: jtojnar at gmail dot com
Operating system: NixOS
PHP version: 7.4.3
Package: XML Writer
Bug Type: Bug
Bug description:XmlWriter::writeAttributeNS produces bad XML with null prefix
Description:
------------
When passing a
$prefix = null to XMLWriter::writeAttributeNs, it
behaves as if empty string was passed, producing a non-well-formed XML
document. Same issue happens with startAttributeNS method but it works
fine for methods for creating elements.
Test script:
---------------
<?php
$writer = new XMLWriter;
$writer->openMemory();
$writer->setIndent(true);
$writer->startElement('foo');
$writer->writeAttributeNS(null, 'test', null, 'test');
// $writer->startAttributeNS(null, 'test', null);
// $writer->text('test');
// $writer->endAttribute();
$writer->endElement();
echo $writer->outputMemory();
Expected result:
----------------
<foo test="test"/>
Actual result:
--------------
<foo :test="test"/>
--
Edit bug report at https://bugs.php.net/bug.php?id=79344&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79344&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79344&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79344&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79344&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79344&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79344&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79344&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79344&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79344&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79344&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79344&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79344&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79344&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79344&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79344&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79344&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79344&r=mysqlcfg