Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49212 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87481 invoked from network); 6 Aug 2010 14:22:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Aug 2010 14:22:35 -0000 Authentication-Results: pb1.pair.com header.from=ralph@smashlabs.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ralph@smashlabs.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain smashlabs.com from 67.15.58.61 cause and error) X-PHP-List-Original-Sender: ralph@smashlabs.com X-Host-Fingerprint: 67.15.58.61 openrce.org Linux 2.6 Received: from [67.15.58.61] ([67.15.58.61:51446] helo=users.smashlabs.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/00-21239-9AA1C5C4 for ; Fri, 06 Aug 2010 10:22:34 -0400 Received: (qmail 19979 invoked from network); 6 Aug 2010 09:22:22 -0500 Received: from ip174-70-101-166.no.no.cox.net (HELO ralph-macbook.local) (174.70.101.166) by smashlabs.com with (DHE-RSA-AES256-SHA encrypted) SMTP; 6 Aug 2010 09:22:22 -0500 Message-ID: <4C5C1AA6.2010902@smashlabs.com> Date: Fri, 06 Aug 2010 09:22:30 -0500 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666 MIME-Version: 1.0 To: Stas Malyshev CC: =?UTF-8?B?Sm9oYW5uZXMgU2NobMO8dGVy?= , Etienne Kneuss , internals Mailing List , derick@php.net References: <1272386738.870.32.camel@guybrush> <4C599C17.5050505@smashlabs.com> <4C5B3B1F.9090905@sugarcrm.com> In-Reply-To: <4C5B3B1F.9090905@sugarcrm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] ArrayAccess::offsetGet not returning a ref From: ralph@smashlabs.com (Ralph Schindler) I can give 2 examples, one that triggers the problem, the other that is a real world issue: --- Simple: array(1,2,3)); public function & offsetGet($name) { $r = & $this->_data['foo']; return $r; } public function offsetSet($name, $value) {} public function offsetExists($name) {} public function offsetUnset($name) {} } $b = new Bar(); $b['foo'][3] = 4; // implies Bar::offsetGet() happens before assign running this produces: $ php -d error_reporting=32767 test-reference-in-arrayaccess.php PHP Fatal error: Declaration of SomeContainer::offsetGet() must be compatible with that of ArrayAccess::offsetGet() in path/to/test-reference-in-arrayaccess.php on line 3 -ralph Stas Malyshev wrote: > Hi! > >> I'd opt for option (d) for all prototype/signature checking. Here's why: > > I think relaxing the check may make sense. Do you have some code example > that doesn't work and you want it to work?