|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #52655 SimpleXMLElement supports ArrayAccess without implementing Interface
Submitted: 2010-08-20 15:14 UTC Modified: 2020-06-22 08:09 UTC
Avg. Score:3.0 ± 0.6
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: ircmaxell at yahoo dot com Assigned: kalle (profile)
Status: Re-Opened Package: SimpleXML related
PHP Version: 5.3.3 OS: CentOS 5.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
23 + 37 = ?
Subscribe to this entry?

 [2010-08-20 15:14 UTC] ircmaxell at yahoo dot com
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:

Actual result:


bug52655 (last revision 2015-03-29 07:17 UTC by

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-20 15:58 UTC]
-Type: Bug +Type: Feature/Change Request
 [2010-08-20 15:58 UTC]
Moved to Feature Request category. 

Could you open a separate bug regarding the documentation of this array-style 
access? Thanks.
 [2010-08-20 17:34 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: kalle
 [2010-08-21 18:22 UTC]
Automatic comment from SVN on behalf of kalle
Log: Fixed bug #52655 (SimpleXMLIterator supports ArrayAccess without implementing the interface)
 [2010-08-21 18:23 UTC]
-Status: Assigned +Status: To be documented -Assigned To: kalle +Assigned To: salathe
 [2010-08-21 18:23 UTC]
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 21:52 UTC]
Automatic comment from SVN on behalf of salathe
Log: simplexmlelement/iterator implements arrayaccess (doc #52655)
 [2010-08-21 21:56 UTC]
-Status: To be documented +Status: Closed
 [2010-08-21 21:56 UTC]
Updated SimpleXMLElement/SimpleXMLIterator interfaces list and added a changelog to SimpleXMLElement synopsis page.
 [2010-08-22 13:39 UTC]
-Status: Closed +Status: Re-Opened
 [2010-08-22 13:39 UTC]
As written on php-doc-cvs@, its as of 5.3.4, not trunk :)
 [2010-08-22 13:39 UTC]
As written on php-doc-cvs@, its as of 5.3.4, not trunk :)
 [2010-08-22 13:47 UTC]
-Status: Re-Opened +Status: Closed
 [2010-08-22 13:47 UTC]
We can't document a version number which does not exist. For now, the changelog will say "Future".  When a release is made which contains this change, the docs can be updated to reflect that.
 [2010-08-23 19:01 UTC]
Automatic comment from SVN on behalf of pajoye
Log: - revert fix for #52655, rev. 302614
 [2010-08-23 19:18 UTC]
-Status: Closed +Status: Re-Opened
 [2010-08-23 19:18 UTC]
reverted as the fix breaks many tests.
 [2010-08-23 21:54 UTC]
-Assigned To: salathe +Assigned To: kalle
 [2010-08-23 21:54 UTC]
I need to re-implement some additional code here before the correct fix will be there
 [2015-03-29 07:17 UTC]
The following patch has been added/updated:

Patch Name: bug52655
Revision:   1427613447
 [2015-03-29 07:18 UTC]
-Status: Re-Opened +Status: Feedback
 [2015-03-29 07:18 UTC]
I added a patch for this, but I'm sure there is a better way to do this than what the patch does
 [2015-04-12 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2020-06-22 08:09 UTC]
-Summary: SimpleXMLIterator supports ArrayAccess without implementing Interface +Summary: SimpleXMLElement supports ArrayAccess without implementing Interface -Status: No Feedback +Status: Re-Opened
 [2020-06-22 08:09 UTC]
This issue still exists.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Sep 26 00:01:24 2020 UTC