|  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: 2021-07-16 04:31 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:
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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ircmaxell at yahoo dot com
New email:
PHP Version: OS:


 [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.
 [2021-07-16 04:31 UTC]
-Assigned To: kalle +Assigned To:
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 08:01:32 2024 UTC