Edit report at https://bugs.php.net/bug.php?id=63477&edit=1
ID: 63477 Updated by: [email protected] Reported by: ryanve at gmail dot com Summary: DOMDocument::loadHtml error in parsing attribute names -Status: Open +Status: Not a bug Type: Bug Package: DOM XML related Operating System: Linux PHP Version: 5.3.18 Block user comment: N Private report: N New Comment: This doesn't actually have much to do with PHP. This completely depends on whether the version of libxml2 you are using has support for this part of HTML5. I haven't looked into it, but I know there were HTML5 additions in libxml2 version 2.8.0. So in order to track this down, figure out which version of libxml2 you are using. Head over to http://xmlsoft.org/ and see if there is a more recent version that handles your case. If there isn't, open a feature request with them. If there is, ask Dreamhost to update their libxml2. Previous Comments: ------------------------------------------------------------------------ [2012-11-09 22:08:24] ryanve at gmail dot com Description: ------------ HTML data attribute names can contain periods: `<p data-1.5>This is valid in HTML5</p>` DOMDocument::loadHtml does not properly parse the line above due to the period. It changes the 1.5 to 1 and/or throws an error: Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: error parsing attribute name in Entity Please see: http://www.w3.org/TR/html-markup/syntax.html#syntax-attributes http://stackoverflow.com/questions/13283699/sanitize-attribute-name I am using Dreamhost: PHP version: 5.3.13 (FastCGI) PHP build date: 2012-06-07 Test script: --------------- <?php # this throws an error: $dom = new DOMDocument; $dom->loadHtml('<a data-1.5="value"></a>'); echo $dom->saveHtml(); # this works fine: $dom = new DOMDocument; $a = $dom->createElement('a'); $a->setAttribute('data-1.5', 'value'); $dom->appendChild($a); echo $dom->saveHtml(); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63477&edit=1
