|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28099 ArrayObject doesn't implement ArrayAccess
Submitted: 2004-04-21 21:38 UTC Modified: 2004-04-25 13:14 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: wast33d at hotmail dot com Assigned: helly
Status: Closed Package: Class/Object related
PHP Version: 5.0.0RC2 OS: *
Private report: No CVE-ID:
 [2004-04-21 21:38 UTC] wast33d at hotmail dot com
It seems that ArrayObject should implement ArrayAccess given that it already implements Traversable.  For me to know if a given variable can be accessed with the [] operator, I need to do:

if (is_array($obj) || $obj instanceof ArrayAccess || $obj instanceof ArrayObject) { }

Reproduce code:
function array_check($obj) {
	if (is_array($obj)) {
		print "Is an array()<br />\n";
	if ($obj instanceof ArrayAccess) {
		print "Implements ArrayAccess<br />\n";
	if ($obj instanceof ArrayObject) {
		print "Is an instance of ArrayObject<br />\n";

array_check(new ArrayObject(array()));

Expected result:
Implements ArrayAccess
Is an instance of ArrayObject

Actual result:
Is an instance of ArrayObject


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-22 22:15 UTC]
Here's a patch to fix the open SPL issues:
It would be nice to have it tested prior to comitting it after RC2.
 [2004-04-25 13:14 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Wed Nov 25 22:01:32 2015 UTC