Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73344 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37684 invoked from network); 20 Mar 2014 20:05:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2014 20:05:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 108.166.43.83 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.83 smtp83.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.83] ([108.166.43.83:54766] helo=smtp83.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FA/31-33112-D1A4B235 for ; Thu, 20 Mar 2014 15:05:49 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp3.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id DE3A750E82; Thu, 20 Mar 2014 16:05:46 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp3.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 8875650A90; Thu, 20 Mar 2014 16:05:46 -0400 (EDT) Message-ID: <532B4A1B.5090503@sugarcrm.com> Date: Thu, 20 Mar 2014 13:05:47 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Etienne Kneuss CC: Tjerk Meesters , PHP Internals References: <532A3E88.20202@sugarcrm.com> <532A418A.8020607@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Merge PR 621 From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > The current behavior is: > > isset() -> has_dimension(check_exmpty=false) -> offsetExists() > empty() -> !has_dimension(check_exmpty=true) -> !offsetExists() > || offsetGet() I think isset part is wrong - it should use offsetGet (probably via check_empty=true) and then verify that the result is not null. > This patch is about decoupling has_dimension from isset()/empty() and > doing, instead: > > isset() -> has_dimension() && get_dimension() !== NULL -> > offsetExists() && offsetGet() !== NULL > empty() -> !has_dimension() || !get_dimension() -> > !offsetExists() && !offsetGet() I'm not sure this is the right way to go. It changes the existing API without any need - while it can be handled within the existing API as well. > Now it is clear it is a BC breaking change for people that defined > offsetExists with array_key_exists: isset() which returned true for NULL > will now invoke offsetGet and thus return false, but it is a change > towards more consistency. This is actually OK, isset should return for ArrayObject the same it would return for array with the same data. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227