Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73409 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90821 invoked from network); 25 Mar 2014 03:45:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Mar 2014 03:45:28 -0000 Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.176 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.220.176 mail-vc0-f176.google.com Received: from [209.85.220.176] ([209.85.220.176:54940] helo=mail-vc0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/11-19971-6DBF0335 for ; Mon, 24 Mar 2014 22:45:26 -0500 Received: by mail-vc0-f176.google.com with SMTP id lc6so6704310vcb.7 for ; Mon, 24 Mar 2014 20:45:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ZiRTiGkhl+QBYtA2NdRAl+S4IjtxOhwNUl/63OwN26o=; b=fSl83BsaETWmvncU+kmEyFyVnUjKeZ9xPggk2eC7cvL/8gHOFizQ0y+uGwQKU7W/84 oyC32/fQGVxEVqo1cSfPO3mUcFxZd3WIrTnK/f2PZSuVqzeuTiWxnFrm1GXuOIpO5/2n 7+SQtPCMSWiHk4y3kl8drkNG0RoTjN4yl9ZUKtZ2O4hTobIT73a9NXRISNsN3toCnGDy dwtWlLp7qQWDkT2Na8TVBRNhdIKp2Cn2JZ/Tc5i4ECvTeLa8Spm7gbjnrVHYX0Aclh8s G1EL6/S3TqrOsj7D0lDO8P+6P64zbLJHdvX6xLI+yUWHfuf+6G26C1vBHcN1zLtGD81+ QfXA== MIME-Version: 1.0 X-Received: by 10.52.251.199 with SMTP id zm7mr46031519vdc.21.1395719123506; Mon, 24 Mar 2014 20:45:23 -0700 (PDT) Received: by 10.58.55.131 with HTTP; Mon, 24 Mar 2014 20:45:23 -0700 (PDT) In-Reply-To: <5330F929.3080000@sugarcrm.com> References: <532A3E88.20202@sugarcrm.com> <532A418A.8020607@sugarcrm.com> <532B4A1B.5090503@sugarcrm.com> <532B6581.6030801@sugarcrm.com> <532B91AF.7090804@sugarcrm.com> <5330F929.3080000@sugarcrm.com> Date: Tue, 25 Mar 2014 11:45:23 +0800 Message-ID: To: Stas Malyshev Cc: Etienne Kneuss , PHP Internals Content-Type: multipart/alternative; boundary=001a1135f378901b7104f5662ed0 Subject: Re: [PHP-DEV] Merge PR 621 From: tjerk.meesters@gmail.com (Tjerk Meesters) --001a1135f378901b7104f5662ed0 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Mar 25, 2014 at 11:34 AM, Stas Malyshev wrote: > Hi! > > > Do you have any issues with the code as it stands now? > > > > https://github.com/php/php-src/pull/614 > > Something I don't understand in this patch: so if we don't have "has" > override, we'd get value == NULL and then we go and check internal > hashtable. Shouldn't we first check the get override and ask it with > BP_VAR_IS, and only if get override is not there use direct hash access? > It's my understanding that you should (have to) only call "get" if you know that the offset exists. > > E.g. imagine this: > > class SecretArrayObject extends ArrayObject > { > public function offsetGet($offset) { > var_dump('Called: '.__METHOD__); > return parent::offsetGet(str_rot13($offset)); > } > public function offsetSet($offset) { > var_dump('Called: '.__METHOD__); > return parent::offsetSet(str_rot13($offset)); > } > } > > I think on this example your code may fail to go to correct items when > doing isset/isempty, since if I ask for 'qux' it would actually check > the value I've put there for 'dhk'. > This particular class should override `offsetExists($offset)` as well, i.e.: public function offsetExists($offset) { return parent::offsetExists(str_rot13($offset)); } > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > -- -- Tjerk --001a1135f378901b7104f5662ed0--