From: daniel dot gorski at develnet dot org Operating system: Linux PHP version: 5.2.0RC5 PHP Bug Type: Scripting Engine problem Bug description: Return of DOMDocument methods misbehave if an error handler is set
Description: ------------ If the set_error_handler() is set, the DOM-methods do not care about '@' if they run into an error/warning. When one tries to load a broken XML document via the DOMDocument#load / DOMDocument#loadXML (maybe others?) the warning won't be supressed, by using '@' if the set_error_handler() has been set before. If no set_error_handler() has been set before, the DOM methods behave as expected in this very case. The problem here is, that if one wants to use his own error handler, the mentioned DOM functions will break the program flow, without any chance of recovery. >From my POV, this is easy to fix, but important to have. Please take a look at it. Thank you. Reproduce code: --------------- <?php // Removing this function call will do. set_error_handler('myErrorHandler', E_ALL | E_STRICT | E_RECOVERABLE_ERROR); function myErrorHandler($severity, $msg) { die($msg); } // --- $dom = new DOMDocument(); $flag = @$dom->loadXML('<root><BROKEN-ELEMENT></root>'); // -----^ echo $flag ? 'Passed' : 'Failed'; ?> Expected result: ---------------- Output of 'Failed' string. Actual result: -------------- Error (Warning?): DOMDocument::loadXML() [function.DOMDocument-loadXML]: Opening and ending tag mismatch: BROKEN-ELEMENT line 1 and root in Entity, line: 1 -- Edit bug report at http://bugs.php.net/?id=39173&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39173&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39173&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39173&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39173&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39173&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39173&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39173&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39173&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39173&r=support Expected behavior: http://bugs.php.net/fix.php?id=39173&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39173&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39173&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39173&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39173&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39173&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39173&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39173&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39173&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39173&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39173&r=mysqlcfg