Bug #63503 [Opn->Nab]: DOMDocument::loadHTML prints warning while loading well-formed xhtml

From: Date: Mon, 02 Dec 2013 14:48:28 +0000
Subject: Bug #63503 [Opn->Nab]: DOMDocument::loadHTML prints warning while loading well-formed xhtml
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183062@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63503&edit=1 ID: 63503 Updated by: mike@php.net Reported by: gdec at prz-rzeszow dot pl Summary: DOMDocument::loadHTML prints warning while loading well-formed xhtml -Status: Open +Status: Not a bug Type: Bug Package: DOM XML related Operating System: Linux fpm-fcgi PHP Version: 5.4.8 Block user comment: N Private report: N New Comment: The operation succeeds, so the warning is just informational. If you don't want libxml warnings printed, use internal error handling. This is libxml's behavior. Previous Comments: ------------------------------------------------------------------------ [2012-11-13 14:01:12] gdec at prz-rzeszow dot pl Description: ------------ Exact PHP version is 5.4.7. In the sample code, the variable $html contains a valid xhtml document. The method DOMDocument::loadHTML does not expect however the </br> closing tag. Test script: --------------- $html=<<<EOD <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>test</title></head> <body><p> test<br></br>test</p></body> </html> EOD; $dom = new DOMDocument(); $dom->loadHTML($html); Expected result: ---------------- expected result: no warning should be printed. Actual result: -------------- <br /> <b>Warning</b>: DOMDocument::loadHTML(): Unexpected end tag : br in Entity, line: 5 in <b>[...][...]</b> on line <b>10</b><br /> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63503&edit=1

« previous php.bugs (#183062) next »