Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88356 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16390 invoked from network); 18 Sep 2015 20:36:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2015 20:36:04 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.179 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.179 mail-wi0-f179.google.com Received: from [209.85.212.179] ([209.85.212.179:38776] helo=mail-wi0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 15/31-09127-3B57CF55 for ; Fri, 18 Sep 2015 16:36:03 -0400 Received: by wiclk2 with SMTP id lk2so44784860wic.1 for ; Fri, 18 Sep 2015 13:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type:subject:from:date:to :message-id; bh=rrlKA+/drhgnpqmjz5GXuY6XU9CaEaHAh2Qx2/Vi8SY=; b=fvQkHgIL4CIGa6DuaAfF2ESV3/VNILbv9YUd4ZuGQGWf6laFdVsWXBi7ope2XD+xKD utvJojJ6gGjKjZeUV9W2G0QTTRGnQWYNQwAX2M6wFDKLCIZKLhiK17or1fV27081NzX+ XaD/vI5t2UQ2E3K5l3PeQ8l+oZSHpfCvOcm/RSgYKX/c7o2fOA0McVscbrwxrwPgPEKt ElcF7bdlfYXHXH19YNAl6R8sp2GZvMk3AHlT0dndjiD520733W0ac24jvpIKahIaAOpU xnNTD0n7IbeZxfA7kXF8sgskaEBBCOWA5LcZZ+M5//os8NCpEfw2rhJfADTlh6V4WD4a XN7Q== X-Received: by 10.194.123.4 with SMTP id lw4mr9279207wjb.94.1442608560755; Fri, 18 Sep 2015 13:36:00 -0700 (PDT) Received: from [192.168.0.6] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by smtp.gmail.com with ESMTPSA id m4sm10586888wjb.37.2015.09.18.13.35.59 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Sep 2015 13:35:59 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: References: <55FB3A60.1040601@gmail.com> <55FB4270.7000204@lsces.co.uk> <55FB4969.7080600@gmail.com> <55FB5BA6.6050606@lsces.co.uk> <55FBF265.5000502@gmail.com> <55FBF7B7.4050603@lsces.co.uk> <55FC1A77.7090406@gmail.com> <55FC221A.7020108@lsces.co.uk> <55FC2588.6030809@gmail.com> <55FC2B17.3070909@lsces.co.uk> <55FC2F2F.9060403@gmail.com> <55FC33F1.3090903@lsces.co.uk> <55FC354B.5070209@gmail.com> <55FC39B2.5070005@lsces.co.uk> <55FC45C7.9010202@gmail.com> <55FC4991.1050903@lsces.co.uk> <7872E9F4-AE19-4681-B2EF-215751AE4CBE@thesba.com> <55FC5A14.8020301@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Date: Fri, 18 Sep 2015 21:32:58 +0100 To: Benoit Schildknecht ,internals@lists.php.net Message-ID: Subject: Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28? From: rowan.collins@gmail.com (Rowan Collins) On 18 September 2015 20:37:07 BST, Benoit Schildknecht wrote: >So there is a bug regarding variables and null. Because I don't get any > >notice if I use a variable with "null" as a value. If "null" means >"uninitialized", how come there are no notices ? It's the other way around - null doesn't mean uninitialized, but an uninitialized variable has the implicit value null. It's also a reasonably likely sign that there's a bug in your code, so PHP gives you a notice suggesting you set it explicitly before reading from it. > I personally use array_key_exists(), but most people won't >do >the same at all. Because they think it is the same. And they'll forget, As I've said several times, a simplified name and syntax for array_key_exists might be a good idea. >Using is_null() against a var to see if it is set and has a null value >WILL trigger notices, and that's clearly not clean at all. Sure, which is exactly why isset() makes sense. If we could rename it quiet_is_null(), would you think it's behaviour made sense? >There are way more cases in which exists() would improve things A LOT. >We >need a native function that allows us to check this state WITHOUT >triggering a notice. Adding exists() has absolutely nothing to do with avoiding notices. It is simply not true that you can do things now and receive notices which you could do with exists() and receive no notices. The things you could do with exists are simply impossible right now. It would not be a replacement for is_null, nor for isset(), but a way of writing a completely new type of code, which examined not a variable's value, but its state within the Engine. Regards, -- Rowan Collins [IMSoP]