#41258 [Bgs]: setAttributeNS has inconsistent behaviour when raising exceptions
| From: | daniel dot oconnor at gmail dot com | Date: | Wed, 02 May 2007 14:50:34 +0000 |
| Subject: | #41258 [Bgs]: setAttributeNS has inconsistent behaviour when raising exceptions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112179@lists.php.net to get a copy of this message | ||
ID: 41258
User updated by: daniel dot oconnor at gmail dot com
Reported By: daniel dot oconnor at gmail dot com
Status: Bogus
Bug Type: DOM XML related
PHP Version: 5.2.1
New Comment:
This is not a functionality bug, but a usability one.
Please see http://clockwerx.blogspot.com/2007/05/bogus-this.html
for
more detail - it expands on some of the real world use problems related
to the behavior exhibited here. Take it with a grain of salt, because
I've been fighting this code all day and am more than a little cranky.
Previous Comments:
------------------------------------------------------------------------
[2007-05-02 12:54:03] rrichards@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Line 4 is fine as namespace URI with an associated prefix already
exists (it was created when from line 3). The prefix gets attached to
the attribute. Error messages are not a bug, but feel free to open a
feature request for more verbose messages though.
------------------------------------------------------------------------
[2007-05-02 08:55:59] daniel dot oconnor at gmail dot com
Description:
------------
Inconsistent behaviour when raising exceptions. No exception is raised
until line 10
Reproduce code:
---------------
<?php
$d = new DOMDocument();
$example = $d->createElementNS('http://foo.com','example');
$example->setAttributeNS('http://bar.com',
'bar:bar',"value");
$example->setAttributeNS('http://bar.com',
'monkey',"value");
$d = new DOMDocument();
$example = $d->createElementNS('http://foo.com','example');
$example->setAttributeNS('http://fish.com',
'bar:bar',"value");
$example->setAttributeNS('http://bar.com',
'monkey',"value");
Expected result:
----------------
1. An exception raised on the second setAttributeNS (line 4)
2. A more meaningful error than 'Namespace Error' - "No namespace
prefix found for <http://fish.com>"
Actual result:
--------------
An exception on line 10
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41258&edit=1