Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51887 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11340 invoked from network); 14 Apr 2011 10:19:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Apr 2011 10:19:07 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rquadling@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qy0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:61195] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 14/3B-44901-91AC6AD4 for ; Thu, 14 Apr 2011 06:19:06 -0400 Received: by qyk32 with SMTP id 32so3233663qyk.8 for ; Thu, 14 Apr 2011 03:19:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=YKyau98Q9dB7dnhDI/Y08ibzds9dbGpjmIwyDRuJmV0=; b=BqQElzhs1MW4djDWmWiVENHm3V0F5TeoUZIJPCRLaxbYIESOCqoWP270M3pHITsWGh 1YWsGBt/xw8qN24MjYwzEwrKMXkGWObejJTaOxORSnr4aYCPue7JwHFJyuTqMMP7UCjB Hfow2uyH5iASOZLeaLbblShOqwzZQkJ02S6l4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; b=ZvC0ofiS5Qlb1DqfDTeWlazgrzeVPNojPKpy+6BvIe0+1wd0VKldb8sq0Km1g06x94 eTQD6pbsJUm4V9DZlyMFxBww/u0QkhIPBsHyXZ/GNlrtJh7/YQ3L8tvG5rRX+l/60Axt P748mVMTfVwc5FViekdZn/uC3XuqU6drnQ3sk= Received: by 10.229.36.133 with SMTP id t5mr375427qcd.102.1302776343615; Thu, 14 Apr 2011 03:19:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.106.194 with HTTP; Thu, 14 Apr 2011 03:18:41 -0700 (PDT) Reply-To: RQuadling@googlemail.com In-Reply-To: <4DA6C74F.2020104@thelounge.net> References: <4D950434.3060704@yahoo.com.au> <4D9E0543.1080600@lerdorf.com> <69.82.36433.EC33E9D4@pb1.pair.com> <4D9E34C4.5000406@lerdorf.com> <4D9E429B.20503@sugarcrm.com> <4D9E96B6.6060401@lerdorf.com> <718216446.20110408143441@cypressintegrated.com> <4DA0E71C.9030008@gmail.com> <4DA63ED8.4080402@yahoo.com.au> <4DA6C74F.2020104@thelounge.net> Date: Thu, 14 Apr 2011 11:18:41 +0100 Message-ID: To: Reindl Harald Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator From: rquadling@gmail.com (Richard Quadling) On 14 April 2011 11:07, Reindl Harald wrote: > > Am 14.04.2011 12:02, schrieb Richard Quadling: > >> I always declare my variables. So, I don't want to use isset() as they >> will be an incorrect test. I use is_null(). Specifically testing the >> value. If I've made a mistake and NOT declared the variable (or made a >> typo), I want to know. I don't want to hide it with isset()/empty() > > yes and no > > $config['modulename'] =3D array > ( > =C2=A0'icon' =3D> 'bla.gif', > =C2=A0'default_params' =3D> array > =C2=A0( > =C2=A0'autocleanup' =C2=A0 =C2=A0 =C2=A0 =3D> 1, > =C2=A0'ignore_user_abort' =3D> 0, > =C2=A0) > ); > > > if 'default_params' are optional you NEED isset() to decide > do something with them or skip operations > > I think that depends upon the developer. I don't mix the tests for existence. Mixing the tests means a typo in the isset() will hide the lack of existenc= e. But array_key_exists() is not going to do that. If the key exists then I can process it. If not, then I can't. --=20 Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY