From: tomas_matousek at hotmail dot com Operating system: WinXP PHP version: 5.1.0b2 PHP Bug Type: SPL related Bug description: ArrayAccess - getOffset doesn't work
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. -- Edit bug report at http://bugs.php.net/?id=33582&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33582&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33582&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33582&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33582&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33582&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33582&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33582&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33582&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33582&r=support Expected behavior: http://bugs.php.net/fix.php?id=33582&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33582&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33582&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33582&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33582&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33582&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33582&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33582&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33582&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33582&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33582&r=mysqlcfg