Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90358 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48037 invoked from network); 8 Jan 2016 15:50:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jan 2016 15:50:18 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.45 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.45 mail-wm0-f45.google.com Received: from [74.125.82.45] ([74.125.82.45:33082] helo=mail-wm0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/0E-55593-9BADF865 for ; Fri, 08 Jan 2016 10:50:17 -0500 Received: by mail-wm0-f45.google.com with SMTP id f206so140957134wmf.0 for ; Fri, 08 Jan 2016 07:50:17 -0800 (PST) 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=eVkV2askJ5Jw7zp7AB1EXnbJh+LbjGT6NuB/CNT3Hoc=; b=HAIEs5aWBosXsrUaPHk5VD0s/7uWl0R4tMshpFt+spR5gW48nsXsfQ00hDgLFzJGtD IvIwh4huwAYy1j8ikYVvWvwsIiqC9U1ptyJpNZ/hzf0TTSefUEwADnYh040sGRZu46CL DMqGDTDFGGOR+o+a881J3692UBFHKRzdE84aWzyW50qJYotfufKZE+Zn0MAne79xb3L8 bktU375AAZD55VojdBklobLutBaI7fiZrxTB1+0/Z66/dNBuBVwWA9t95u8PjeFyYveQ /hSEYuDMEtb6G4rke7ic/nUWKwfS+pFn47ygF7bsGKqNEAXFtfKxEVEHDAi6m56gpkmQ ZVdg== X-Received: by 10.28.210.143 with SMTP id j137mr23414211wmg.13.1452268214076; Fri, 08 Jan 2016 07:50:14 -0800 (PST) Received: from [192.168.0.137] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id r10sm82045917wjz.24.2016.01.08.07.50.13 for (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Jan 2016 07:50:13 -0800 (PST) To: internals@lists.php.net References: Message-ID: <568FDA4B.60005@gmail.com> Date: Fri, 8 Jan 2016 15:48:27 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.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] Deprecation of the Error Control Operator (@ symbol) From: rowan.collins@gmail.com (Rowan Collins) Dan Ackroyd wrote on 06/01/2016 17:12: > Work on a plan on how to migrate all internal errors/warnings to > individual exceptions. The current way of using set_error_handler to > convert warnings/errors into generic exceptions isn't good enough. Again, you're focussing exclusively on that sub-set of warnings which are actually errors in disguise. I think it would be perfectly reasonable to implement a new file handling API, which behaves like modern PHP (objects, exceptions, etc) rather than being a thin wrapper for C (which is why fopen() does what it does). There'd then be no particular need to "suppress" any exceptions thrown from that, because if the handle is invalid, you actually need to do something different in the catch clause. In the current C-based API, the "catch" is the "if ( $fh === false )"; the warning is actually superfluous, hence the desire to suppress it. But this doesn't actually present a solution to the dozens of other warnings and notices. It doesn't do anything to help Stas's example for instance: @$counts[$item]++; This is not something which should ever throw an exception, however easy that exception was to discard. On the other hand, the "suppress" operator might be usable in conjunction with categorised warnings; e.g. $counts[$item]++ suppress ET_ARRAY_NOSUCHKEY; I would also contend that a correctly thrown exception should never be something you want to just suppress - at the very least, you want to log it, and probably you want to skip or add some logic. For instance, this makes no sense to me: $db = new PDO($dsn) suppress PDO_Exception; // oops, now I have to check if $db instanceof PDO, rather than just jumping to catch/finally @ doesn't suppress exceptions, nor does it stop fatal errors being fatal; nor should its replacement. Regards, -- Rowan Collins [IMSoP]