|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36878 error messages are printed even though an exception has been thrown
Submitted: 2006-03-27 23:44 UTC Modified: 2006-03-28 00:08 UTC
From: Assigned: tony2001 (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2006-03-27 (CVS) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
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:
Solve the problem:
42 - 37 = ?
Subscribe to this entry?

 [2006-03-27 23:44 UTC]
Error messages are printed when parsing invalid XML document despite of the fact that they should be (and are) converted to exceptions.

Reproduce code:

function err2exc($errno, $errstr, $errfile, $errline) {
    throw new Exception($errstr);

$xml = '<?xml version="1.0"?>

    <bbb>ddddd < </bbb>


set_error_handler('err2exc', E_ALL);

try {
    $doc = DOMDocument::loadXML($xml);
} catch (Exception $e) {
    echo "Exception caught\n";


Expected result:
Exception caught
string(73) "DOMDocument::loadXML(): StartTag: invalid element name in Entity, line: 4"

Actual result:
Warning: DOMDocument::loadXML(): expected '>' in Entity, line: 7 in /tmp/1.php on line 26
Exception caught
string(73) "DOMDocument::loadXML(): StartTag: invalid element name in Entity, line: 4"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-28 00:08 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 26 10:03:36 2021 UTC