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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
7 + 12 = ?
Subscribe to this entry?

 
 [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 23:01:28 2024 UTC