From:             wast33d at hotmail dot com
Operating system: Windows XP Pro
PHP version:      5.0.0RC1
PHP Bug Type:     Class/Object related
Bug description:  ArrayObject doesn't implement ArrayAccess

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

-- 
Edit bug report at http://bugs.php.net/?id=28099&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28099&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28099&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28099&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28099&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28099&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28099&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28099&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28099&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28099&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28099&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28099&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28099&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28099&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28099&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28099&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28099&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28099&r=float

Reply via email to