#29495 [Sus]: New DOM and XSL classes should throw exceptions.

From: Date: Tue, 01 Feb 2005 17:03:42 +0000
Subject: #29495 [Sus]: New DOM and XSL classes should throw exceptions.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73191@lists.php.net to get a copy of this message
ID: 29495 Updated by: chregu@php.net Reported By: tony at marston-home dot demon dot co dot uk Status: Suspended Bug Type: Feature/Change Request Operating System: * PHP Version: 5.0.0 New Comment: This is not a discussion forum. We will have better error-reporting in PHP 5.1. *Not* based on exceptions. Stop whining or contribute code ;) bug closed Previous Comments: ------------------------------------------------------------------------ [2005-01-28 23:45:33] amt@php.net One of the main goals of the PHP 5 DOM extension is trying to obey the DOM spec whenever possible. Therefore, the policy is that DOM always throws exceptions: 1) In the constructor (this is a PHP 5 issue) 2) Where the DOM spec says an exception should be omitted The loadXML() method is probably an edge case, as I don't believe it's part of the official DOM spec. I actually think it's no longer part of the recommendation, but we're keeping it in for backwards compatibility. Regardless, this method was prototyped to return a boolean and not throw an exception. http://www.w3.org/TR/2002/WD-DOM-Level-3-LS-20020725/load-save.html#LS-DocumentLS-loadXML So that's what it does. ------------------------------------------------------------------------ [2005-01-28 22:50:42] rodent at mighty dot co dot za I don't really see why try/catch shouldn't be used for things like loadXML. A DOMException is raised for EVERYTHING but loadXML, or load. Why should they be treated differently from the other DOM methods? It's been a real pain porting my sablotron based XML/XSLT transformation code to php5, and even with all the hacks I implemented, it's nowhere NEAR the kind of error reporting I could do with the sablotron XSLT module. I truly believe this should be reinvestigated. ------------------------------------------------------------------------ [2004-08-03 10:01:00] chregu@php.net PHP 5.1 will have new error handling functionality (nothing written yet, but will almost certainly not use try/catch but error handler callbacks) You have to wait for that... ------------------------------------------------------------------------ [2004-08-02 18:15:39] tony at marston-home dot demon dot co dot uk Description: ------------ I have just started using the new DOM and XSL classes in PHP5, and one thing I really find annoying is the difficulty in trapping errors. I tried to use the new try... catch... syntax but this does not work. I have worked out another way of detecting errors from these two classes, but it is very messy. Can they be changed to use the new try...cath... syntax? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29495&edit=1

« previous php.bugs (#73191) next »