Req #29495 [Sus->Csd]: New DOM and XSL classes should throw exceptions.
| From: | cmb@php.net | Date: | Thu, 29 Sep 2016 17:31:41 +0000 |
| Subject: | Req #29495 [Sus->Csd]: New DOM and XSL classes should throw exceptions. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-204345@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=29495&edit=1
ID: 29495
Updated by: cmb@php.net
Reported by: tony at marston-home dot demon dot co dot uk
Summary: New DOM and XSL classes should throw exceptions.
-Status: Suspended
+Status: Closed
Type: Feature/Change Request
Package: *General Issues
Operating System: *
PHP Version: 5.0.0
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Well, PHP 5.1 brought libxml_use_internal_errors() and friends, so
this ticket can be closed.
Previous Comments:
------------------------------------------------------------------------
[2005-02-01 18:03:41] chregu@php.net
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
------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=29495&edit=1