Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87280 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33018 invoked from network); 24 Jul 2015 23:59:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2015 23:59:07 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.169 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.169 mail-pd0-f169.google.com Received: from [209.85.192.169] ([209.85.192.169:35823] helo=mail-pd0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/E2-10459-A41D2B55 for ; Fri, 24 Jul 2015 19:59:06 -0400 Received: by pdrg1 with SMTP id g1so20465359pdr.2 for ; Fri, 24 Jul 2015 16:59:04 -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=6xUPkMU3TVjLYpAR0RyDF8odPIoTbYNW7orPGD3xEc0=; b=IPuQmc8n96nnUzpg3hMXZopQ/mRljJs96WOkCACzkDzn2mrtTe6KkMVzu/CT1W4/ne kSdiuTKbAJ1S5UK4yzf72L02BLPvPUl58dDhea43a3w8SdXYyMo75YUMZyNdd5qWhLx5 NyjJp86D6vT782Qqzs/d4mupFTpcR96O9JMhGL5kaMcKHg7iBHBE06slZTOer993r/0P atHYAd6jO3NtbL17kOzZqrFcHLt4c6tPGGzb7M+SudYb45mCD9twpDFz2PTG9GQLoYVw sHYSmInjXWv8xfq+eUC1tUHcjG+53LFDIgIvLjOR/YMY3GnZ4+jQZe20czD+RWVRE3aZ TXkQ== X-Received: by 10.70.48.98 with SMTP id k2mr37250610pdn.69.1437782344090; Fri, 24 Jul 2015 16:59:04 -0700 (PDT) Received: from Stas-Air.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by smtp.gmail.com with ESMTPSA id u8sm16555684pdj.46.2015.07.24.16.59.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2015 16:59:03 -0700 (PDT) To: Brian Moon , Sammy Kaye Powers , PHP Internals References: <55A7D993.5000301@moonspot.net> X-Enigmail-Draft-Status: N1110 Message-ID: <55B2D142.6020802@gmail.com> Date: Fri, 24 Jul 2015 16:58:58 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55A7D993.5000301@moonspot.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Core functions throwing exceptions in PHP7 From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > On the surface, this sounds like a good thing. Although, I question that > if a user is not checking $result === false, then will they end up just > wrapping this in an empty try/catch so their code does not fail? There > is a mechanism to detect the error now. True, but not checking for false is an error of omission, and an easy one to make ("How can random fail? It's just creating random numbers! I won't bother to check"), while wrapping in try/catch has to be done explicitly - and can be easily caught on review, even often with automatic tools, and people can be trained not to do empty try/catches (it is much easier to train for "do not do this specific thing" than "always do these 1000 things in 1000 different special cases"). > I question why the cryptographic functions would not force an integer to > be passed. Those should not accept a boolean and evaluate it as false. I > am not sure what functions you are talking about though. Maybe 3rd party > user land code? Accepting a boolean in those cases is a bug in that code > IMO. Given PHP is a weakly-typed language, I don't thing you can rely on this kind of type checking. While in many cases we can tell people "just check for errors or accept the fallout", when we come to security I think the price is too high. -- Stas Malyshev smalyshev@gmail.com