Bug #55285 [Opn->Csd]: XMLReader::getAttribute/No/Ns methods inconsistency
| From: | mike@php.net | Date: | Thu, 03 Oct 2013 13:23:27 +0000 |
| Subject: | Bug #55285 [Opn->Csd]: XMLReader::getAttribute/No/Ns methods inconsistency | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182001@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55285&edit=1
ID: 55285
Updated by: mike@php.net
Reported by: evoloshchuk at gmail dot com
Summary: XMLReader::getAttribute/No/Ns methods inconsistency
-Status: Open
+Status: Closed
Type: Bug
Package: XML Reader
Operating System: Mac OS X 10.6.3
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c7b1d76eb9d09b0331272143e44e5024468b0fea
Log: fix bug #55285 XMLReader::getAttribute/No/Ns methods inconsistency
Previous Comments:
------------------------------------------------------------------------
[2011-07-26 12:18:24] evoloshchuk at gmail dot com
Description:
------------
There are three methods available to retrieve an attribute - getAttribute, getAttributeNo,
getAttributeNs.
It seems to be natural to expect the similar kind of behavior from them in case when no attribute by
given parameters is found.
Which is not the case - first one returns NULL, the rest - string(0) "".
Test script:
---------------
<?php
$reader = new XmlReader();
$reader->xml('<?xml version="1.0" encoding="UTF-8"?><a
y="" z="1"></a>');
$reader->read();
var_dump($reader->getAttribute('x'));
var_dump($reader->getAttributeNs('x', 'http://example.com'));
var_dump($reader->getAttributeNo(2));
?>
Expected result:
----------------
NULL
NULL
NULL
Actual result:
--------------
NULL
string(0) ""
string(0) ""
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55285&edit=1