#36878 [NEW]: error messages are printed even though an exception has been thrown
| From: | tony2001@php.net | Date: | Mon, 27 Mar 2006 21:44:33 +0000 |
| Subject: | #36878 [NEW]: error messages are printed even though an exception has been thrown | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-94936@lists.php.net to get a copy of this message | ||
From: tony2001@php.net
Operating system: Linux
PHP version: 5CVS-2006-03-27 (CVS)
PHP Bug Type: Scripting Engine problem
Bug description: error messages are printed even though an exception has been thrown
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 bug report at http://bugs.php.net/?id=36878&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36878&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36878&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36878&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36878&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36878&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36878&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36878&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36878&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36878&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36878&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36878&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36878&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36878&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36878&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36878&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36878&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36878&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36878&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36878&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36878&r=mysqlcfg