Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88351 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3493 invoked from network); 18 Sep 2015 18:39:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2015 18:39:19 -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.178 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.178 mail-wi0-f178.google.com Received: from [209.85.212.178] ([209.85.212.178:34859] helo=mail-wi0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 98/78-60254-65A5CF55 for ; Fri, 18 Sep 2015 14:39:18 -0400 Received: by wicge5 with SMTP id ge5so44047882wic.0 for ; Fri, 18 Sep 2015 11:39:14 -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=tsOkGhNazAqt+URTbnprYW+zfamI3sxHzEPcthOUeOg=; b=wEQrf+eE+oAspCaIyM4xpxXs0kaBuFcKCnzG1fMXHb+DFmK2trTyFpkBozQPL5zKTP EVUk/TMn/zv43+CrWlgqzdV2RlhjstoLMFQS1s80uFs3qk9Xy0KRrgWwuS9imBMWwE8B T2eJrnlMY1RmfVcORVs72qnNoUAFkphbmGZWmArvUS2o5VSAp9qxfhhkG1eQtp6pKVKO LKJufq0T4t4kRjn1pfxWEF5ndjjcIJzxFeHM9SP3HZrcLauAGQcnAwBdiLyXXZ7ctGT/ iSdRaXzDS9dpSu4SoItvOdcI0wUZkHCSjFxfcsJRFpgUERay2gvAH4Xk0Eor1JoVYw9m r1/w== X-Received: by 10.180.102.164 with SMTP id fp4mr40681314wib.2.1442601554767; Fri, 18 Sep 2015 11:39:14 -0700 (PDT) Received: from [192.168.0.127] ([62.189.198.114]) by smtp.googlemail.com with ESMTPSA id d8sm7166812wiy.1.2015.09.18.11.39.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2015 11:39:10 -0700 (PDT) To: internals@lists.php.net References: <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> <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> Message-ID: <55FC5A14.8020301@gmail.com> Date: Fri, 18 Sep 2015 19:38:12 +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: 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) Benoit Schildknecht wrote on 18/09/2015 19:24: > I agree. exists() would allow PHP devs to make more secure, cleaner > and lighter code. It fills a gap and would be useful to a lot of devs. On the contrary, I think code using exists() would be extremely fragile, because it's highly resistant to refactoring, and encourages developers to leave variables uninitialised. What makes cleaner, more secure code is always initialising your variables before using them - basically, what the "undefined variable" Notice is suggesting you do. The examples Lester and Robert have come up with make sense in themselves, but are not architectures I would choose precisely because they are opaque (you have to remember what unset() and null mean) and hard to extend (there's no way to introduce a 4th state alongside the unset/null/value triad). Obviously, all language features can be used to write bad code, but it seems much easier to write bad code than good using this proposed function. Regards, -- Rowan Collins [IMSoP]