Bug #64399 [NEW]: ArrayObject works with ArrayObject as input but not ArrayAccess
| From: | kotlyar dot maksim at gmail dot com | Date: | Sat, 09 Mar 2013 09:13:33 +0000 |
| Subject: | Bug #64399 [NEW]: ArrayObject works with ArrayObject as input but not ArrayAccess | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-177698@lists.php.net to get a copy of this message | ||
From: kotlyar dot maksim at gmail dot com
Operating system:
PHP version: Irrelevant
Package: SPL related
Bug Type: Bug
Bug description:ArrayObject works with ArrayObject as input but not ArrayAccess
Description:
------------
This code sample works fine
<?php
$input = new \ArrayObject;
$input['whatever'] = 'foo';
$array = new \ArrayObject($input);
var_dump($array['whatever']);
// will it return foo? right!
so I expected that it should work same way for objects implemented
ArrayAccess
interface. But it is not true.
Test script:
---------------
https://gist.github.com/makasim/5123486
Expected result:
----------------
either YourCustomArrayObject::offsetExists or
YourCustomArrayObject::offsetGet is
called
It should output 1 or 2 and exit the script
Actual result:
--------------
PHP Notice: Undefined index: whatever in /home/maksim/test.php on line
57
--
Edit bug report at https://bugs.php.net/bug.php?id=64399&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64399&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64399&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64399&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64399&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64399&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64399&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64399&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64399&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64399&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64399&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64399&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64399&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64399&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64399&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64399&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64399&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64399&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64399&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64399&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64399&r=mysqlcfg