From: ryanve at gmail dot com Operating system: Linux PHP version: 5.3.18 Package: DOM XML related Bug Type: Bug Bug description:DOMDocument::loadHtml error in parsing attribute names
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 bug report at https://bugs.php.net/bug.php?id=63477&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63477&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63477&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63477&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63477&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63477&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63477&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63477&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63477&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63477&r=support Expected behavior: https://bugs.php.net/fix.php?id=63477&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63477&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63477&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63477&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63477&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63477&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63477&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63477&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63477&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63477&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63477&r=mysqlcfg
