Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88375 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84545 invoked from network); 19 Sep 2015 14:50:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2015 14:50:01 -0000 Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 217.147.176.214 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 217.147.176.214 mail4-2.serversure.net Linux 2.6 Received: from [217.147.176.214] ([217.147.176.214:38432] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4A/24-43089-7167DF55 for ; Sat, 19 Sep 2015 10:50:00 -0400 Received: (qmail 6143 invoked by uid 89); 19 Sep 2015 14:49:56 -0000 Received: by simscan 1.3.1 ppid: 6135, pid: 6139, t: 0.3804s scanners: attach: 1.3.1 clamav: 0.96/m:52/d:10677 Received: from unknown (HELO ?10.0.0.8?) (lester@rainbowdigitalmedia.org.uk@86.160.91.166) by mail4.serversure.net with ESMTPA; 19 Sep 2015 14:49:56 -0000 To: Rowan Collins , internals@lists.php.net 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> <55FC8D53.3080904@lsces.co.uk> <93020C79-3920-4FC8-8B6B-F1D16C6C709C@gmail.com> Message-ID: <55FD7613.1080403@lsces.co.uk> Date: Sat, 19 Sep 2015 15:49:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <93020C79-3920-4FC8-8B6B-F1D16C6C709C@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28? From: lester@lsces.co.uk (Lester Caine) On 19/09/15 13:15, Rowan Collins wrote: >> I don't >> >see any 'completely new type of code' ... only a different frame in >> >which the variables are held. > It's "completely new" because you can't do it right now, that's all. > > I'm just trying to separate two different justifications for requesting this feature: some people are saying their current code is buggy because of some lack in the language, and that "thousands and millions of devs" encounter this; others, such as yourself, are saying that they would like to write code in a certain style, which the language doesn't currently allow. I have still seen absolutely no evidence of the former, most bugs apparently being due to poor adoption of array_key_exists; I am reasonably convinced by your use case being valid, even if it's not a style I'd choose. > > Every time you start talking about avoiding notices, and existing code, I therefore get confused - there is no code using exists() in order for it to be buggy! If there was a bug with 'isset' it is that it returns false for a variable that IS SET to null. So using isset only returns true when there is an actual value assigned to the variable. There is not an array_key_isset(), but array_key_exists() which returns true for all cases of the variable existing. So I can call array_key_exists() followed by is_null() and be sure that I will not get a warning from the is_null() call because the variable has to exist, and the function is 'exists' rather than 'isset' for that very reason. Moving back to plain variables, we can check a variable isset(), if the variable has been created and is null, then we don't have a problem, but if the variable does not exist there is no way of testing for that state prior to calling is_null() so we get a warning. THAT is the warning that I'm talking about. Now if you have another way of identifying that the variable 'exists' before calling is_null() then I apologise but I've not found it yet :( -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk