Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88334 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71702 invoked from network); 18 Sep 2015 15:36:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2015 15:36:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.170 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:38212] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F4/22-60254-C6F2CF55 for ; Fri, 18 Sep 2015 11:36:13 -0400 Received: by wiclk2 with SMTP id lk2so36011218wic.1 for ; Fri, 18 Sep 2015 08:36:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=0dmiZGIhDXA5NYdM9hiM8vePMZMv9Hizt9PkGzuf7oQ=; b=QVXAd5SzaNwfbdVYEbHzpKAqTaGeYC45DeDdbh8fs1qRfEWcllB+oIvst5W4mxgFfg OpMeEWfz4nE6Tk9LvPZc6bl0E8rT332SL5/dQbcI78VnF6SpECI3ZNJHUarN3NPYSLun /YNzj+ZF9ZNMagGGm3Ta0VtXGvwym88NDfGv8+gXW/z1jFrsqhQidk8oaG6ewjTOOg1c sOEOm64CXa6tctK9h6nxfngxTSvWwQwN9Kot4JQ7LnlacLYiiKE1qH6U6e2gHnHfzdVm UchbTRp6yDGl/KldzauniHs1NfizehAOkrXeuJVrxjGcPWskpaVjB4XRQ84mb9mDXJSU JN7w== X-Received: by 10.194.93.198 with SMTP id cw6mr8744099wjb.113.1442590570062; Fri, 18 Sep 2015 08:36:10 -0700 (PDT) Received: from [192.168.0.127] ([62.189.198.114]) by smtp.googlemail.com with ESMTPSA id p8sm9435267wjr.39.2015.09.18.08.36.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2015 08:36:09 -0700 (PDT) To: internals@lists.php.net References: <55F6F08C.1020506@gmail.com> <0BEF6D82-CB5F-49F6-A3A4-3267924A0CDA@thesba.com> <55F72CA9.2060301@gmail.com> <09369945-76FE-4E08-9C2C-15FB0577AD27@thesba.com> <55F752E7.9070801@gmail.com> <55F9B4C7.3050700@gmail.com> <440C64A2-4B4F-4AEF-ACE3-F3A6637EBAB6@thesba.com> <55F9D704.5050002@lsces.co.uk> <55F9EFA2.9020908@lsces.co.uk> <0022A1D9-DC37-4F49-B58E-FBED5AF872BA@gmail.com> <55F9FAB3.2050100@lsces.co.uk> <55FB19CB.7080707@gmail.com> <55FB3117.5040204@lsces.co.uk> <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> Message-ID: <55FC2F2F.9060403@gmail.com> Date: Fri, 18 Sep 2015 16:35:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <55FC2B17.3070909@lsces.co.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28? From: rowan.collins@gmail.com (Rowan Collins) Lester Caine wrote on 18/09/2015 16:17: > You don't do much real database coding do you ... > > NULL is returned for fields that have no entry on a secondary table, so > the result set NATURALLY returns NULL. Why do you keep going on about null? We're talking about non-existent variables, not null! > We have been living with the fact > that PHP barf's when trying to check for NULL for a long time. OK, now you've lost me. I can check for NULLs just fine, using is_null() if I know the variable exists (which I pretty much always do) or isset() if it might not. No barfing necessary. > There are a number of ways those variables can be generated and switching off the > notices is currently the only way. The only way to do what? If you have a variable which is either null or non-existent, and you don't care which, use isset(). That's literally the same as turning off notices and then using is_null(). > exists() has a place in SOME coding > styles which does not require to find the 'NULL' some other way to avoid > the potential notice! exists() would not be a way of avoiding the notice. exists() would be a way of distinguishing an extra state, quite separate from null. If what you want to write is "if ( ! exists($foo) || is_null($foo) ) { ... }" then that is exactly what "if ( isset($foo) )" will give you, without any notices whatsoever. Regards, -- Rowan Collins [IMSoP]