Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90147 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95371 invoked from network); 5 Jan 2016 20:24:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2016 20:24:47 -0000 Authentication-Results: pb1.pair.com header.from=aaron@icicle.io; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=aaron@icicle.io; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain icicle.io designates 199.38.81.6 as permitted sender) X-PHP-List-Original-Sender: aaron@icicle.io X-Host-Fingerprint: 199.38.81.6 mercury.negativeion.net Received: from [199.38.81.6] ([199.38.81.6:54121] helo=mercury.negativeion.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 21/46-12097-E862C865 for ; Tue, 05 Jan 2016 15:24:46 -0500 Received: from localhost (localhost [127.0.0.1]) by mercury.negativeion.net (Postfix) with ESMTP id E7CAE32B60DF; Tue, 5 Jan 2016 15:24:43 -0500 (EST) X-Virus-Scanned: amavisd-new at negativeion.net Received: from mercury.negativeion.net ([127.0.0.1]) by localhost (mercury.negativeion.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id C69J7VRWRLY5; Tue, 5 Jan 2016 15:24:43 -0500 (EST) Received: from macpro.local (unknown [173.225.158.77]) by mercury.negativeion.net (Postfix) with ESMTPSA id F3ED332B60D4; Tue, 5 Jan 2016 15:24:42 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) In-Reply-To: Date: Tue, 5 Jan 2016 14:24:36 -0600 Cc: Ferenc Kovacs , Andrea Faulds , Junade Ali , grzegorz129@gmail.com, PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <68A8B669-7A42-41B1-9E1E-9D3441C2AD70@icicle.io> References: <4F.0A.12097.24FFB865@pb1.pair.com> To: Sara Golemon X-Mailer: Apple Mail (2.2104) Subject: Re: [PHP-DEV] Deprecation of the Error Control Operator (@ symbol) From: aaron@icicle.io (Aaron Piotrowski) > On Jan 5, 2016, at 12:22 PM, Sara Golemon wrote: >=20 > On Tue, Jan 5, 2016 at 10:09 AM, Ferenc Kovacs = wrote: >>>> I don't think that would work out too well. Remember that many = projects >>>> have >>>> error handles which convert all errors to exceptions: if you = disable @ >>>> in >>>> those projects, wouldn't their code break? >>>>=20 >>> Nope. >>> Supressed errors already reach custom error handlers: >>> https://3v4l.org/TG8aA >>=20 >> sure and most projects check the error_reporting() level against the = $errno >> like in the manual: >> if (!(error_reporting() & $errno)) { >> // This error code is not included in error_reporting >> return; >> } >>=20 >> @ changes the error_reporting() level for that particular call, so = those >> custom error handler won't throw exceptions for the suppressed errors = but >> when you remove/nop @ their code would throwing stuff left and right. >>=20 > Today I learned... Okay, def a problem (for a specific set of > circumstances). And one which makes me more amenable to Ze'ev > declare() suggestion (on a per-request bases, not per-file) as anyone > modifying a project's codebase for testing can also modify it to > suppress those exceptions as needed and/or just not enable the custom > error handler. >=20 Exactly. There=E2=80=99s no need for a new ini setting, since an error = handler can be written that ignores the current error level and throws = an exception or does whatever the coder wants. Abuse is the only real problem with the @ operator. Coders use it in = place of proper state or error checking. However, there are legitimate = uses such as with fwrite, fopen, stream_select, etc. that Grzegorz = Zdanowski and I pointed out. Before anything can be done with the @ = operator, changes will need to be made to remove warnings for conditions = that the code has no way of checking prior to calling these functions. = Setting a custom error handler before calling these functions and = removing the error handler afterwards is a clunky solution. Any proposal = to remove the @ operator needs to address how functions issuing = unavoidable warnings will be changed. Aaron Piotrowski https://trowski.com @trowski2002=