Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88366 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36209 invoked from network); 18 Sep 2015 23:04:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2015 23:04:56 -0000 Authentication-Results: pb1.pair.com header.from=francois@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.27.42.6 as permitted sender) X-PHP-List-Original-Sender: francois@php.net X-Host-Fingerprint: 212.27.42.6 smtp6-g21.free.fr Received: from [212.27.42.6] ([212.27.42.6:41126] helo=smtp6-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A3/D0-31193-7989CF55 for ; Fri, 18 Sep 2015 19:04:55 -0400 Received: from [127.0.0.1] (unknown [82.232.41.54]) (Authenticated sender: flaupretre@free.fr) by smtp6-g21.free.fr (Postfix) with ESMTPSA id 17C0082246; Sat, 19 Sep 2015 00:57:03 +0200 (CEST) To: Rowan Collins , Benoit Schildknecht , 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> Cc: Robert Williams Message-ID: <55FC988E.5000502@php.net> Date: Sat, 19 Sep 2015 01:04:46 +0200 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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Antivirus: avast! (VPS 150918-1, 18/09/2015), Outbound message X-Antivirus-Status: Clean Subject: Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28? From: francois@php.net (=?UTF-8?Q?Fran=c3=a7ois_Laupretre?=) Hi Rowan, Le 18/09/2015 22:32, Rowan Collins a écrit : > > 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 think we got the point now ;)... and it seems eveyone except you and Stas disagree on the way you understand this. I guess 99.9 % of PHP devs would tell you that accessing an uninitialized variable triggers an error. You can argue that a 'notice' is not an error but, in practice, everybody considers it this way. Nobody will tell you : 'Oh, that's just a notice, just disable E_NOTICE in your php.ini'. As I already said, IMO, modifying the documentation to say "Warning: using isset() instead of array_key_exists() to test whether an array element exists will send you to hell." won't change anything. People currently writing 'isset($foo['bar'])' won't change it for 'array_key_exists('bar',$foo)'. Just because it is longer, less readable, and you need to remember argument order (which is quite counter-intuitive). So, as everyone seems to have exposed his arguments, I think we need an RFC and a patch now. Unless anyone volunteers, I'll write the patch. Who can write the RFC ? Robert ? Regards François