ID: 33645
Updated by: [EMAIL PROTECTED]
Reported By: vma1 at abv dot bg
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Linux
PHP Version: 5.1.0b2
New Comment:
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same.
Thank you for your interest in PHP.
See bug #32983 and bug #33582
Previous Comments:
------------------------------------------------------------------------
[2005-07-11 15:18:48] vma1 at abv dot bg
Description:
------------
It is not possible to modify an element of an array returned by
ArrayAccess::offsetGet(). Also the error message suggests that
offsetGet() should return a reference but it is not possible due to the
offsetGet() original declaration.
Reproduce code:
---------------
<?
class obj_array implements ArrayAccess
{
private $array;
public function __construct ($array)
{
$this->array = $array;
}
public function offsetExists ($index)
{
return (array_key_exists ($index, $this->array));
}
public function offsetGet ($index)
{
return ($this->array [$index]);
}
public function offsetSet ($index, $value)
{
$this->array [$index] = $value;
}
public function offsetUnset ($index)
{
unset ($this->array [$index]);
}
}
$obj = new obj_array (array ("index_1" => array ("index_2" => 123)));
$obj ["index_1"]["index_2"] = 456;
?>
Expected result:
----------------
Nothing should be displayed when the code is run.
Actual result:
--------------
Fatal error: Objects used as arrays in post/pre increment/decrement
must return values by reference in /archive/try.php on line 33
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33645&edit=1