Bug #74989 [NEW]: DOMElement::setAttribute() should report error when @xml:space = 'foo'
| From: | paul at sparrowhawkcomputing dot com | Date: | Tue, 25 Jul 2017 21:37:20 +0000 |
| Subject: | Bug #74989 [NEW]: DOMElement::setAttribute() should report error when @xml:space = 'foo' | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-210328@lists.php.net to get a copy of this message | ||
From: paul at sparrowhawkcomputing dot com
Operating system: Windows 10 Pro
PHP version: 5.6.31
Package: DOM XML related
Bug Type: Bug
Bug description:DOMElement::setAttribute() should report error when @xml:space = 'foo'
Description:
------------
To conform to the XML spec, DOMElement::setAttributeNS() [and other
related methods like DOMDocument::createAttributeNS(), etc] incorrectly
allows @xml:space='foo'.
See the related bug (https://bugs.php.net/bug.php?id=74988) for the
details on WHY this should not be allowed.
Test script:
---------------
libxml_use_internal_errors( true );
libxml_clear_errors();
$dom = new DOMDocument();
$root = $dom->createElement( 'root' );
$root->setAttributeNS( 'http://www.w3.org/XML/1998/namespace',
'xml:space', 'foo' );
$errs = libxml_get_errors();
$dom->appendChild( $root );
$xml = $dom->saveXML();
var_dump( $errs );
var_dump( $xml );
Expected result:
----------------
Either:
DOMElement::setAttributeNS() [and other related methods like
DOMDocument::createAttributeNS(), etc) should return false and
libxml_get_errors() should report the well-formedness error
or
DOMElement::setAttributeBS() should return true but just ignore
setting the attribute and it's value.
Actual result:
--------------
array(0) {
}
string(46) "<?xml version="1.0"?>
<root xml:space="foo"/>
"
--
Edit bug report at https://bugs.php.net/bug.php?id=74989&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74989&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74989&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74989&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74989&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74989&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74989&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74989&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74989&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74989&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74989&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74989&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74989&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74989&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74989&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74989&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74989&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74989&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74989&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74989&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74989&r=mysqlcfg