php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63503 DOMDocument::loadHTML prints warning while loading well-formed xhtml
Submitted: 2012-11-13 14:01 UTC Modified: 2013-12-02 14:48 UTC
Votes:4
Avg. Score:4.2 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:3 (75.0%)
From: gdec at prz-rzeszow dot pl Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.4.8 OS: Linux fpm-fcgi
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gdec at prz-rzeszow dot pl
New email:
PHP Version: OS:

 

 [2012-11-13 14:01 UTC] 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 />

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-02 14:48 UTC] mike@php.net
-Status: Open +Status: Not a bug
 [2013-12-02 14:48 UTC] mike@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 12:01:31 2024 UTC