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

 ID:                 52655
 Updated by:         sala...@php.net
 Reported by:        ircmaxell at yahoo dot com
 Summary:            SimpleXMLIterator supports ArrayAccess without
                     implementing Interface
-Status:             To be documented
+Status:             Closed
 Type:               Feature/Change Request
 Package:            SimpleXML related
 Operating System:   CentOS 5.5
 PHP Version:        5.3.3
 Assigned To:        salathe
 Block user comment: N

 New Comment:

Updated SimpleXMLElement/SimpleXMLIterator interfaces list and added a
changelog to SimpleXMLElement synopsis page.


Previous Comments:
------------------------------------------------------------------------
[2010-08-21 21:52:42] sala...@php.net

Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&revision=302623
Log: simplexmlelement/iterator implements arrayaccess (doc #52655)

------------------------------------------------------------------------
[2010-08-21 18:23:57] ka...@php.net

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 :)

------------------------------------------------------------------------
[2010-08-21 18:22:48] ka...@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] sala...@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

Reply via email to