Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60453 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47837 invoked from network); 4 May 2012 21:24:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 May 2012 21:24:07 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pb0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:57109] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/F4-18322-6F844AF4 for ; Fri, 04 May 2012 17:24:07 -0400 Received: by pbbrp12 with SMTP id rp12so4669343pbb.29 for ; Fri, 04 May 2012 14:24:03 -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=4EhQEdF8Wn/4Zznh8EVmTBUKVbO6OrqMlaD6UGgWwSo=; b=Weg9bvipu7bpj1fGD/qSuAivvIr/HxYlfT4yZhU8zbZlqh2qrGa35qUmO4XDEnsw4I 1nDyvnAD+P+8QeGuPn5ko6M3CMln2N+YvzCA9VKXPQ3Rz88wHIcPU0Kazv0JIXKVfwNG SIs2H8vxIZUB9UX2//71vjkOUeyTvCG0lGcCFnXYxxRCVzEpJEQlYfEOW+PnDHNat65Q cSE3e7jr6PkNT+xn4VLm0x8+r1reCLzRPdDu1RMfqyDEZV+w100bufZUiTC5hpe/2czi eRHwDoP+hQMHgOa8O0V3/5f39PebOpdF+SkVN82zVAM/e6UiXfPB7fZ7hPHxeLWo3Evf vp4g== MIME-Version: 1.0 Received: by 10.68.221.105 with SMTP id qd9mr18853405pbc.1.1336166642975; Fri, 04 May 2012 14:24:02 -0700 (PDT) Received: by 10.68.229.197 with HTTP; Fri, 4 May 2012 14:24:02 -0700 (PDT) In-Reply-To: References: <396c1a02d4e7195f2b89e26ace2276a6.squirrel@www.l-i-e.com> Date: Fri, 4 May 2012 23:24:02 +0200 Message-ID: To: Kris Craig Cc: Richard Lynch , PHP internals Content-Type: multipart/alternative; boundary=e89a8ff256821d81f404bf3c8a7e Subject: Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset() From: tyra3l@gmail.com (Ferenc Kovacs) --e89a8ff256821d81f404bf3c8a7e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > > > Hmm I'd never really thought about that before. But now that you mention > it, that does sound like a problem. Honestly, I can see no value in > maintaining a different "standard" for what constitutes a set or not-set > variable depending on the function. While I understand Pierre's point th= at > people have used $var =3D NULL; in the past to unset variables, I don't t= hink > we should actually be supporting that. After all, $var =3D (anything, > including nothing) is, by definition, "setting" the variable to something > (or nothing). > > I would analogize this to a printed dictionary. Let's say you look up th= e > word, "glarbofatass". It's not there. So you take out another dictionar= y > and look it up again. There's an entry for it, but the entry says, "This > word has no meaning." In the first dictionary, "glarbofatass" is not set= . > In the second dictionary, "glarbofatass" is set to the state of having n= o > meaning. Nevertheless, it *is* set. > > I've never thought of setting something to NULL as being *literally *the > same thing as unsetting it (though the purpose and end result are mostly > the same). If we didn't have an unset() function, I might feel different= ly > about this. But we do, so really I don't see why "=3D NULL" needs to be = an > alias for unset(). To be honest, I doubt this would pose any real BC > breakage, either, unless someone can point me to an instance where somebo= dy > uses "=3D NULL" to unset a variable and then checks it with isset() later= , > expecting FALSE. > > Personally, I would consider "=3D NULL" =3D=3D unset() but only as it per= tains > to isset() to be a bug that should be fixed, not a "feature" that should = be > preserved. And if we make that change (perhaps target it for PHP 6 since > it would nonetheless pose a fundamental logic change, albeit an extremely > minor and low-impact one), then this RFC suddenly makes a lot more sense > while allowing the scope to be limited to empty() without creating any > annoying contradictions. > > then maybe you should open a separate rfc and thread for that. btw. $foo =3D null; doesn't equals/aliases unset($foo); only isset() writt= en in a way so that it checks the existence of the variable AND if it exists then checks that it's value isn't null. maybe this isn't nice for a newcommer to the language, but it is how isset works for a pretty long time now, and changing it would be a major BC break= . not impossible, but that would definitively deserve a separate RFC and discussion. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --e89a8ff256821d81f404bf3c8a7e--