|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-10-03 13:23 UTC] mike@php.net
[2013-10-03 13:23 UTC] mike@php.net
-Status: Open
+Status: Closed
[2013-11-17 09:30 UTC] laruence@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 06:00:01 2025 UTC |
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) ""