Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88006 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58202 invoked from network); 2 Sep 2015 09:06:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2015 09:06:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=craig@craigfrancis.co.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=craig@craigfrancis.co.uk; sender-id=pass Received-SPF: pass (pb1.pair.com: domain craigfrancis.co.uk designates 209.85.212.177 as permitted sender) X-PHP-List-Original-Sender: craig@craigfrancis.co.uk X-Host-Fingerprint: 209.85.212.177 mail-wi0-f177.google.com Received: from [209.85.212.177] ([209.85.212.177:34860] helo=mail-wi0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/00-57033-20CB6E55 for ; Wed, 02 Sep 2015 05:06:12 -0400 Received: by wicge5 with SMTP id ge5so32974528wic.0 for ; Wed, 02 Sep 2015 02:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=craigfrancis.co.uk; s=default; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=S2OOdXWZZ4HDTG0Jz01Q0PvQZ9U3y2nbw0z3wXTAqCA=; b=PI526UwUXgVPvhDJJRh6RObheIGpPbb+rIpginx89oWHGH3gvwuk6XGRIbWHfk70Mv BXbEEApCNRcfeJplYKA5pdYH9ZcmE0O+qJ540R4A6FpcOBI+1Vnkxskpn0r5OqeFWiXl waKyiXKCcdYWU/TiH3+lGfvv+HbUeGeYwT1HU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=S2OOdXWZZ4HDTG0Jz01Q0PvQZ9U3y2nbw0z3wXTAqCA=; b=et51gtdKO5oeR0hvhmqe15ohDbiSXK3Hpxb5av5WO/a0Vw2FK6eeubiALcxsqaeHQh feFHofcBv8ZaEO3hI+hUTcJHil1Yf2C4nmgyhvfavPmLnjdmS0Xkfi7IvXQc8WTyR9Mz nBoX5mTvyouSNZADVhPauoxr58CvqNDS9Q4HjFlkX2OyAFYcas2Ro7GWrLyKLKtte7uN PXXZjLHtr4+kwwRJMVC2gws7dwvRJxIzHCraIzbkGw61VnzLzjAnNXQUVuqSfJx0uiMP 74H3USCYWqxgx8aGeI3YB/q//Kk9OVmRSJ5HZBvLy8tHxcsBI+/5P/Iv7C+9Jg9TZ9ZA M3jQ== X-Gm-Message-State: ALoCoQlkpKHiu75VDMUqnSJsIK/Rz4/HcJWI1GIZAYtPNi5aEVGN1gKiyzD+FknS90SEMxSqfjVP X-Received: by 10.194.87.102 with SMTP id w6mr37456203wjz.111.1441184768071; Wed, 02 Sep 2015 02:06:08 -0700 (PDT) Received: from [192.168.1.12] (cpc79329-chap9-2-0-cust385.18-1.cable.virginm.net. [82.44.123.130]) by smtp.gmail.com with ESMTPSA id h3sm2524018wiz.9.2015.09.02.02.06.06 (version=TLS1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Sep 2015 02:06:07 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: <55E5EBBF.6020803@gmail.com> Date: Wed, 2 Sep 2015 10:06:05 +0100 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <0BA3A129-D356-4781-B6DE-E2B5A7924AE2@craigfrancis.co.uk> References: <55DD4269.4090402@gmail.com> <6348DFA7-04BD-41BB-A500-17A8A531B56C@craigfrancis.co.uk> <55DDA4C9.9040603@gmail.com> <3C69BF4B-52E6-4D04-8601-8D23DFCC538E@craigfrancis.co.uk> <55DDD60F.5090509@gmail.com> <8C74463E-DBA2-4015-8159-0B44D973387F@craigfrancis.co.uk> <55DE0907.6040904@gmail.com> <1F615BCD-1B9B-4C51-A210-869F1AA1F6E3@craigfrancis.co.uk> <55E5EBBF.6020803@gmail.com> To: Rowan Collins X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28? From: craig@craigfrancis.co.uk (Craig Francis) On 1 Sep 2015, at 19:17, Rowan Collins wrote: > I'm still not sure how exists() would be anything other than an alias = for array_key_exists(). I think that is the case as well (ish). But considering that isset() seems to be the function that is used most = of the time, I want to consider why that is the case. Before last week, if someone asked me to write some code to see if a = variable (or key) exists, I would have simply used isset() without = thinking (this being a problem if the variable was set to NULL). Whereas, if I was told to check if the variable was NULL, I would do an = "$a =3D=3D=3D NULL" or is_null(). It might just be due to the functions name length or usage, while = wanting to avoid undefined variable notices: The second one does also represent the variable in a different way (grep = for "$_GET['q']", where it only appears 3 times in that code). And the second one does not really check for the existence of $_GET, = which in this case is probably ok. Craig On 1 Sep 2015, at 19:17, Rowan Collins wrote: > On 01/09/2015 10:29, Craig Francis wrote: >> Personally I still like the idea of an exists(), because I feel that = is how many programmers treat and use the isset() function - simply = because they do use NULL as a valid value, and either haven't read the = manual, or forget the exception that is mentioned on line 1 (something = I've done a couple of times). >=20 > I'm still not sure how exists() would be anything other than an alias = for array_key_exists(). >=20 > Once again, this is NOT about "using NULL as a valid value"; it's = about "using a variable's NON-EXISTENCE as a valid state". I think that = is the fundamental mistake people make - they think the "quirk" is that = isset() returns false for a null value, when that is the most rational = part of it. The "quirk" is that you don't get a warning when passing a = completely undefined variable to isset(). >=20 > Obviously, that's not something that's likely to change, but as you = say, what we are really testing is "the value pointed at by some = identifier". In an array, that identifier can be dynamic, but in plain = variable scope, that identifier is something you the programmer have = defined long before the program executed, so its existence is never in = question. >=20 > Looked at that way, the handling of unitialised variables is just a = side-effect of the handling of NULLs, since all unitialised variables = have a default/implicit value of NULL. >=20 > Regards, >=20 > --=20 > Rowan Collins > [IMSoP] >=20 >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20