#47108 [NEW]: 0xAE breaks DOMDocument's loadHTML
| From: | terrafrost@php.net | Date: | Wed, 14 Jan 2009 20:08:28 +0000 |
| Subject: | #47108 [NEW]: 0xAE breaks DOMDocument's loadHTML | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-132877@lists.php.net to get a copy of this message | ||
From: terrafrost@php.net
Operating system: Windows XP
PHP version: 5.2.8
PHP Bug Type: DOM XML related
Bug description: 0xAE breaks DOMDocument's loadHTML
Description:
------------
All HTML after chr(0xAE) (if present) is ignored by DOMDocument's
loadHTML(), even if chr(0xAE) is a valid character per the HTML's charset.
In the Reproduce code, replace chr(0xAE) with chr(0xAF) or chr(0xAD) or
just remove it all together, and it works. Further, if you echo out $str
and copy / paste the HTML into validator.w3.org, it's valid HTML, even with
the chr(0xAE).
Reproduce code:
---------------
<?php
$str = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-7">
<title>test</title>
</head>
<body><p>aaaaa' . chr(0xAE) . 'zzzzz</p></body>
</html>';
$xml = new DOMDocument();
$xml->loadHTML($str);
echo $xml->saveHTML();
Expected result:
----------------
aaaaa�zzzzz
Actual result:
--------------
Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: input conversion
failed due to input error, bytes 0xAE 0x7A 0x7A 0x7A in C:\htdocs\test.php
on line 14
Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: input conversion
failed due to input error, bytes 0xAE 0x7A 0x7A 0x7A in C:\htdocs\test.php
on line 14
Warning: DOMDocument::loadHTML() [domdocument.loadhtml]:
htmlCheckEncoding: encoder error in Entity, line: 4 in C:\htdocs\test.php
on line 14
Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: input conversion
failed due to input error, bytes 0xAE 0x7A 0x7A 0x7A in C:\htdocs\test.php
on line 14
aaaaa
--
Edit bug report at http://bugs.php.net/?id=47108&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47108&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47108&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47108&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47108&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47108&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47108&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47108&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47108&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47108&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47108&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47108&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47108&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47108&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47108&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47108&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47108&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47108&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47108&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47108&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47108&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47108&r=mysqlcfg