Edit report at https://bugs.php.net/bug.php?id=63217&edit=1
ID: 63217
Updated by: laruence@php.net
Reported by: kmsheng at pixnet dot tw
Summary: Behavior of implementing the ArrayAccess interface
has been changed in php 5.4
Status: Open
-Type: Bug
+Type: Documentation Problem
Package: Arrays related
Operating System: freebsd
PHP Version: 5.4Git-2012-10-04 (Git)
Block user comment: N
Private report: N
New Comment:
numeric string key will cast to number, I think this is a improvement, to be
consistent with the internal dim fetch.
but yeah, we need a document of such change, change to doc problem.
Previous Comments:
------------------------------------------------------------------------
[2012-10-04 10:14:49] kmsheng at pixnet dot tw
Description:
------------
Execute the test script provided below in php 5.3.10 and php 5.4.0-3 may get different results which
are string(1) "0" and int(0).
I don't know if this is a bug or a patch.
Test script:
---------------
<?php
class Test implements ArrayAccess {
public function offsetExists($off)
{
}
public function offsetUnset($off)
{
}
public function offsetSet($off, $el)
{
}
public function offsetGet($off)
{
var_dump($off);
}
}
$test = new Test();
$test['0'];
Expected result:
----------------
string(1) "0"
Actual result:
--------------
int(0)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63217&edit=1