|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-07-13 11:45 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 05:00:01 2025 UTC |
Description: ------------ Since you fixed this issue: "Fixed inheritance check to control return by reference and pass by reference correctly (ArrayAccess can no longer support references correctly)." offsetGet doesn't work correctly not only with references. I would suggest you to change interface and require return by reference for offsetGet. This would fix also issues regarding references. Reproduce code: --------------- class C { public $x; } $z = new C; class ArrayClass implements ArrayAccess { function offsetGet($index) { global $z; $result = array("obj" => $z); return $result; } function offsetSet($index, $newval) { } function offsetExists($index) { } function offsetUnset($index) { } } $obj = new ArrayClass(); $obj["index"]["obj"]->x = 10; Expected result: ---------------- I would expect no error. The code is imho correct. Actual result: -------------- Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference.