|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-10-17 04:39 UTC] daniel dot gorski at develnet dot org
[2006-10-17 05:19 UTC] daniel dot gorski at develnet dot org
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 02:00:01 2025 UTC |
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