#36878 [Asn->Csd]: error messages are printed even though an exception has been thrown
| From: | tony2001@php.net | Date: | Mon, 27 Mar 2006 22:08:00 +0000 |
| Subject: | #36878 [Asn->Csd]: error messages are printed even though an exception has been thrown | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-94942@lists.php.net to get a copy of this message | ||
ID: 36878
Updated by: tony2001@php.net
Reported By: tony2001@php.net
-Status: Assigned
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5CVS-2006-03-27 (CVS)
Assigned To: tony2001
New Comment:
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
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-03-27 23:44:32] tony2001@php.net
Description:
------------
Error messages are printed when parsing invalid XML document despite of
the fact that they should be (and are) converted to exceptions.
Reproduce code:
---------------
<?php
function err2exc($errno, $errstr, $errfile, $errline) {
throw new Exception($errstr);
}
$xml = '<?xml version="1.0"?>
<aaa>
<bbb>ddddd < </bbb>
</aaa
';
set_error_handler('err2exc', E_ALL);
error_reporting(E_ALL);
try {
$doc = DOMDocument::loadXML($xml);
} catch (Exception $e) {
echo "Exception caught\n";
var_dump($e->getMessage());
}
?>
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"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36878&edit=1