note 79496 added to function.ArrayObject-offsetGet

From: Date: Fri, 30 Nov 2007 11:01:55 +0000
Subject: note 79496 added to function.ArrayObject-offsetGet
Groups: php.notes 
Request: Send a blank email to php-notes+get-132676@lists.php.net to get a copy of this message
If you're overloading ArrayObject, it's worth noting that while this method (when implemented by the parent) will return a reference, so code like $fakeArray['foobar']['hello'] = 1; will work like you expect. However, when you overload the offsetGet method, you CANNOT define it as &offsetGet, so the above code falls out (because it returns the 'foobar' variable before you actually work with it). This is something that the developers broke between 5.0 and 5.1, and was closed as bogus (http://bugs.php.net/bug.php?id=34783). So this is not a big, or question, or request, but just something worth noting. ---- Server IP: 213.249.64.162 Probable Submitter: 62.58.16.165 ---- Manual Page -- http://www.php.net/manual/en/function.ArrayObject-offsetGet.php Edit -- https://master.php.net/note/edit/79496 Del: integrated -- https://master.php.net/note/delete/79496/integrated Del: useless -- https://master.php.net/note/delete/79496/useless Del: bad code -- https://master.php.net/note/delete/79496/bad+code Del: spam -- https://master.php.net/note/delete/79496/spam Del: non-english -- https://master.php.net/note/delete/79496/non-english Del: in docs -- https://master.php.net/note/delete/79496/in+docs Del: other reasons-- https://master.php.net/note/delete/79496 Reject -- https://master.php.net/note/reject/79496 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132676) next »