Edit report at https://bugs.php.net/bug.php?id=55285&edit=1

 ID:                 55285
 Updated by:         m...@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

Reply via email to