PHP :: Bug #55285 :: XMLReader::getAttribute/No/Ns methods inconsistency
| Bug #55285 | XMLReader::getAttribute/No/Ns methods inconsistency | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2011-07-26 12:18 UTC | Modified: | - |
|
||||||||||
| From: | evoloshchuk at gmail dot com | Assigned: | ||||||||||||
| Status: | Closed | Package: | XML Reader | |||||||||||
| PHP Version: | 5.3.6 | OS: | Mac OS X 10.6.3 | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2011-07-26 12:18 UTC] 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) ""
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2013-10-03 13:23 UTC] mike@php.net
-Status: Open +Status: Closed