Bug #64399 [Com]: ArrayObject works with ArrayObject as input but not ArrayAccess
| From: | kontakt at qlwik dot vot dot pl | Date: | Sat, 09 Mar 2013 20:42:15 +0000 |
| Subject: | Bug #64399 [Com]: ArrayObject works with ArrayObject as input but not ArrayAccess | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-177708@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64399&edit=1
ID: 64399
Comment by: kontakt at qlwik dot vot dot pl
Reported by: kotlyar dot maksim at gmail dot com
Summary: ArrayObject works with ArrayObject as input but not
ArrayAccess
Status: Open
Type: Bug
Package: SPL related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
I have a pain coz of this
http://www.interkul.com
Previous Comments:
------------------------------------------------------------------------
[2013-03-09 09:13:33] kotlyar dot maksim at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=64399&edit=1