Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60420 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90933 invoked from network); 2 May 2012 11:37:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 May 2012 11:37:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.170 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 74.125.82.170 mail-we0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:35132] helo=mail-we0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B9/C8-38165-18C11AF4 for ; Wed, 02 May 2012 07:37:38 -0400 Received: by werb13 with SMTP id b13so343404wer.29 for ; Wed, 02 May 2012 04:37:35 -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:content-transfer-encoding; bh=BJoBsQ2UxVHtMUIBf+6UumS8fDbmsnl83MZLYuD+498=; b=QljcxaoSUEAC96yJ5c94zY4IwSZ4A/87zxg1FljZu5v7/Z2Npw546/A5E66n8fGEGc QS7dQH5rWrXarEdRsXFtlpEwnCgiSov1PsZHH0EFSBz2ZuP40XLPIM2RVzsA4SrOuaO1 nfxnTRVs14/ZQCp9STWsBLJzWeOsMTIEnxrDhnjTM6OvoanGRgRa+jU2GTfKKF2j938+ V7ref3KXRRjbygVkm9ObddIGsyW1y/YYK2Uwl8s5RPQj7OG/y8xy4UqTWdFWShvAOcoo X98qWWwBCOvf1oc2a++T5fglVcKebWNchigE/DGnRdMNUiMFOWDe0C9RRI+G1jcu7QJY okSA== MIME-Version: 1.0 Received: by 10.216.134.155 with SMTP id s27mr6213962wei.80.1335958654913; Wed, 02 May 2012 04:37:34 -0700 (PDT) Received: by 10.180.146.165 with HTTP; Wed, 2 May 2012 04:37:34 -0700 (PDT) In-Reply-To: References: Date: Wed, 2 May 2012 07:37:34 -0400 Message-ID: To: Pierre Joye Cc: Ferenc Kovacs , Laruence , Patrick ALLAERT , Nikita Popov , PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset() From: ircmaxell@gmail.com (Anthony Ferrara) Pierre, On Wed, May 2, 2012 at 5:43 AM, Pierre Joye wrote: > hi, > > On Wed, May 2, 2012 at 11:36 AM, Ferenc Kovacs wrote: > >> $foo=3Dnull; >> var_dump(isset($foo)); //prints=A0bool(false) > > No offset meant, but it is totally expected and well known, and as far > as I remember documented too. Assigning NULL to a variable unsets it > (so to say). Well, except that it doesn't unset it. It only fails isset(). The symbol still exists in the symbol table, and the zval is still allocated. That's one reason that isset() can return false, and array_key_exists() will return true. But right now there's no way to check if a symbol exists since isset returns falls for a null value in a symbol (and there's no other way to check it)... Not saying it should change, just that it's a corner case that's not accounted for in the API... I voted for the ability to use an expression for isset() as well, since I agree with Ferenc, it's a matter of consistency. Sure, the use-case for isset() is definitely weaker than for empty(), but at the same token they are definitely related... Anthony >>> empty() on the other hand, tests if something is empty, and only if it >>> is empty. The result of an expression can be empty. >>> >> >> an expression can also have a value of null. > > And NULL is empty. No issue here. > > Cheers, > -- > Pierre > > @pierrejoye | http://blog.thepimp.net | http://www.libgd.org > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >