Req #52655 [Asn->Tbd]: SimpleXMLIterator supports ArrayAccess without implementing Interface
| From: | kalle@php.net | Date: | Sat, 21 Aug 2010 16:23:57 +0000 |
| Subject: | Req #52655 [Asn->Tbd]: SimpleXMLIterator supports ArrayAccess without implementing Interface | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-153687@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52655&edit=1
ID: 52655
Updated by: kalle@php.net
Reported by: ircmaxell at yahoo dot com
Summary: SimpleXMLIterator supports ArrayAccess without
implementing Interface
-Status: Assigned
+Status: To be documented
Type: Feature/Change Request
Package: SimpleXML related
Operating System: CentOS 5.5
PHP Version: 5.3.3
-Assigned To: kalle
+Assigned To: salathe
Block user comment: N
New Comment:
Peter, I have fixed the bug in the source and it will be available as of
5.3.4, if you want to take this documentation issue :)
Previous Comments:
------------------------------------------------------------------------
[2010-08-21 18:22:48] kalle@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&revision=302614
Log: Fixed bug #52655 (SimpleXMLIterator supports ArrayAccess without
implementing the interface)
------------------------------------------------------------------------
[2010-08-20 15:58:15] salathe@php.net
Moved to Feature Request category.
Could you open a separate bug regarding the documentation of this
array-style
access? Thanks.
------------------------------------------------------------------------
[2010-08-20 15:14:30] ircmaxell at yahoo dot com
Description:
------------
This is more of a consistency issue, but I'm submitting it as a bug
since it prevents certain type checks in PHP code.
SimpleXMLIterator does not implement the ArrayAccess interface (and
neither does its parent SimpleXML). And the documentation says nothing
about access via array syntax. However the class itself does support
that method of access.
To resolve the issue, two things can be done.
First, documentation should be updated to reflect that method of
access.
Second, SimpleXMLIterator should implement the ArrayAccess interface for
consistency...
Test script:
---------------
$xml = '<items><item>foo</item></items>';
$simple = simplexml_load_string($xml);
var_dump($simple->item instanceof ArrayAccess);
print (string) $simple->item[0];
Expected result:
----------------
bool(true)
foo
Actual result:
--------------
bool(false)
foo
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52655&edit=1