#41339 [NEW]: DomDocument->loadHTML eats HTML without error with multiple meta information
From: rasch at raschnet dot com
Operating system: Ubuntu Linux
PHP version: 5.2.2
PHP Bug Type: DOM XML related
Bug description: DomDocument->loadHTML eats HTML without error with multiple meta information
Description:
------------
In usage of symfony, our code was mistakenly producing a meta tag with two
content types. However, from what I understand it's not invalid, but
either way PHP falls on this, the DOM parser should return an error. The
current behavior is that PHP returns an empty string when calling
'$dom->saveHTML()' in the code sample below.
Reproduce code:
---------------
$dom = new DomDocument("1.0", "utf-8");
$val =$dom->loadHTML('
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8,
text/html; charset=utf-8">
</head>
<body>Hello</body></html>');
var_dump($val);
print $dom->saveHTML();
print "\n^^^ empty string\n";
Expected result:
----------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8,
text/html; charset=utf-8">
</head>
<body><p>Hello</p></body></html>
Actual result:
--------------
bool(true)
// ^^^ empty string
--
Edit bug report at http://bugs.php.net/?id=41339&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41339&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41339&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41339&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41339&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41339&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41339&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41339&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41339&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41339&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41339&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41339&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41339&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41339&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41339&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41339&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41339&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41339&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41339&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41339&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41339&r=mysqlcfg
Thread (5 messages)
- rasch at raschnet dot com