php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45727 DOMDocument::load() is not reporting errors on malformed XML
Submitted: 2008-08-05 15:04 UTC Modified: 2008-08-06 05:33 UTC
From: mephtu at yahoo dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mephtu at yahoo dot com
New email:
PHP Version: OS:

 

 [2008-08-05 15:04 UTC] mephtu at yahoo dot com
Description:
------------
Loading a malformed XML document with DOMDocument::load() fails to report any errors.

Reproduce code:
---------------
load.php:
<?php
$dom = new DOMDocument();
$dom->load('malformed.xml');
?>

malformed.xml:
<tags>data</ags>

Expected result:
----------------
I expected to see an error message.

Actual result:
--------------
Parser dies silently without reporting error.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-06 05:33 UTC] chregu@php.net
I get

"Warning: DOMDocument::load(): Opening and ending tag mismatch: tags 
line 1 and ags in /Users/chregu/tmp/foo.xml, line: 1 in 
/Users/chregu/tmp/foo.php on line 3"

what is to be expected. 

Do you have set the error level correctly? Does it really die after 
load? The script shouldn't stop there.

and maybe http://ch2.php.net/manual/en/function.libxml-use-internal-
errors.php is of help for you
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC