Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90043 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70879 invoked from network); 5 Jan 2016 02:52:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2016 02:52: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:52990] helo=mercury.negativeion.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 60/9A-07292-EFF2B865 for ; Mon, 04 Jan 2016 21:52:47 -0500 Received: from localhost (localhost [127.0.0.1]) by mercury.negativeion.net (Postfix) with ESMTP id 7541532AE054; Mon, 4 Jan 2016 21:52:44 -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 WMTSIuH7tK1v; Mon, 4 Jan 2016 21:52:44 -0500 (EST) Received: from jupiter.local (unknown [173.225.150.231]) by mercury.negativeion.net (Postfix) with ESMTPSA id CFD1D32AE045; Mon, 4 Jan 2016 21:52:43 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.1 \(3096.5\)) In-Reply-To: Date: Mon, 4 Jan 2016 20:52:43 -0600 Cc: PHP internals , Stanislav Malyshev , Junade Ali , Andrea Faulds Content-Transfer-Encoding: quoted-printable Message-ID: <4A04F9B5-C87B-4D4C-BCA4-1CD9F49AC4A0@icicle.io> References: <568599AA.4090209@gmail.com> To: bishop@php.net X-Mailer: Apple Mail (2.3096.5) Subject: Re: [PHP-DEV] Deprecation of the Error Control Operator (@ symbol) From: aaron@icicle.io (Aaron Piotrowski) Hi Bishop, > On Dec 31, 2015, at 3:48 PM, Bishop Bettini wrote: >=20 > I am -1 on removing @ for 7.x series. But, I would be in favor of all > changes that remove unnecessary error messages or add functionality to > better work with error messages. In my mind, those are requisite steps > before removing @. >=20 I am also very much in agreement with this. There are many conditions = where a warning or other error is raised with no way to test for the = condition that will trigger the error. Before the @ can be removed, = either these errors need to be removed or they need to become an = exception that can be caught. For example, I have the following code for = writing to a non-blocking stream (assume $resource is a stream socket = resource and $data is a string): // Error reporting suppressed since fwrite() emits E_WARNING if the pipe = is broken or the buffer is full. $written =3D @fwrite($resource, $data); if (false =3D=3D=3D $written) { $message =3D 'Failed to write to stream.'; if ($error =3D error_get_last()) { $message .=3D sprintf(' Errno: %d; %s', $error['type'], = $error['message']); } throw new FailureException($message); } There is no way of knowing if the stream buffer is full before calling = fwrite(), resulting in a warning and 0 being returned. IMO, just 0 = should be returned without issuing a warning. Aaron Piotrowski https://trowski.com @trowski2002