I just ran into that one yesterday by playing around doing some runtime analysis. I started some XDebug-Like output for Hooks and it looks pretty well so far. Now I’d like to know where Hook’s Callbacks were registered prior to their call. For that I overloaded the hooks array and in the first steps, well run into this bummer I was not aware of so far.
In the end this error message saved me some problems because otherwise I had not learned when offsetGet and when offsetSet is invoked in ArrayAccess in such a detail.
For anybody else having the Issue, these are some resources I found useful to better understand the implications this has and the history of it:
- [PHP-DEV] ArrayAccess::offsetGet not returning a ref (PHP Internals Mailinglist;
27 April 2010 to 07 Aug 2010)
- ArrayAccess multidimensional (un)set? (by anomareh, Alexander Konstantinov and Artefacto; 21 May 2010)
- Arrays of Objects and __get: Friends Forever (by Clark; 11 Jan 2010)
- Overloading arrays in PHP 5.2.0 (by Matthew Weier O’Phinney; 18 Jan 2007)
- Zend Weekly Summaries Issue #314 (by Steph Fox; 13 Nov 2006)
- PHP Bug #39449 – Overloaded array properties do not work correctly (by pstradomski; 9 Nov 2006)