Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103527 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 77273 invoked from network); 29 Nov 2018 00:01:54 -0000 Received: from unknown (HELO mail-pl1-f175.google.com) (209.85.214.175) by pb1.pair.com with SMTP; 29 Nov 2018 00:01:54 -0000 Received: by mail-pl1-f175.google.com with SMTP id t13so17923824ply.13 for ; Wed, 28 Nov 2018 12:25:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=c6Zfz6PkQY4ZpKkghMhPEl0278BMMJNi9xln7upOlkA=; b=Qwuqfr7LfQI2Urmd1B9gCBNdW3YCP1OQPul82Z+CJ4wwM6UnkNCacNVK1/bz8683+U 9GH2mJfZ5cFvIEfKfo4yFYmjR//46YjxyXrNwyAo+7cYTUENu0Xa2d1omSQTl9+NF4gD dD1yNVG8/ZSgOU58dzt7EiO0XfZ017B42E/P5cR4O8VI91noyJQ6sm64C0TjpBo0s1W2 m4UK8FtP6Hl86hRlQSv1fcTWZq6C7Qj08d+RlE7SAnqCORL7pBK4ArN4NNTfBngWr8AP bRNkRtSukftU2vFaXGbfTjfyK9cKeCRzSIhatMgo51FLp+2gsKbxIx6Ny3EDpHGx4gEy d2lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=c6Zfz6PkQY4ZpKkghMhPEl0278BMMJNi9xln7upOlkA=; b=qmR6IKwgyGuFKQkoUbstcq3SSIzp8vBFKrnN+I6zlNeBoMmMjyDh3b6+FBn+rW+/Rt UWk7C6FKVYiR57lfjNs8ZP+cWbBEQssvG1C08fnY7Gumez5adNM2wfsfc7t85AcRQTZZ YMgdA4TefChR47EwwJAIb6TEGGV/8nEsLRWDdIcUfpV3aOmry4Bd4ndEOl+2fqyxYVoU OshtoHBhOLjgGxhpO8e6OXWMd0h4CqNybQP3acp5/AAQSfFW2eKt4/GIrabwOpa6PiLj A3IMZaDR65MxVLMKKIWZFCzDe14F5g22LRAdUl6XjSf9dqdOV4Akt+2dOxuDkC6t6dy/ k1Rw== X-Gm-Message-State: AA+aEWb+TPbZYlIG+DTmfDHK2NglqPbEVk++qjMlrm3jrlLccReslHpi 4KrlB/+hMl4YXZiafaOdf670ST0ZbRkJu8KFHJ0= X-Google-Smtp-Source: AFSGD/Xd6AyWahifGlZ7K6+A/bFUyvlKEOodHDdMbUnvhNwQO/KiQfzJGtVKeo2m3SKD4aUJHC60FzA0ZubMHOewF9w= X-Received: by 2002:a17:902:8a91:: with SMTP id p17mr5130037plo.316.1543436751152; Wed, 28 Nov 2018 12:25:51 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 28 Nov 2018 17:25:14 -0300 Message-ID: To: nikita.ppv@gmail.com Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000492b69057bbf5f54" Subject: Re: [PHP-DEV] Don't silence fatal errors From: casivaagustin@gmail.com (Agustin Casiva) --000000000000492b69057bbf5f54 Content-Type: text/plain; charset="UTF-8" On Mon, Nov 26, 2018 at 6:43 PM Nikita Popov wrote: > Hi internals, > > When the silencing operator @ is used, the intention is generally to > silence expected warnings or notices. However, it currently also silences > fatal errors. As fatal errors also abort request execution, the result will > often be a hard to debug white screen of death. > > The most recent occurrence which motivated me to write this mail is > https://bugs.php.net/bug.php?id=77205, but I've seen this play out > multiple > times already. > > I would like to propose to change the behavior of @ to only silence > warnings, notices and other low-level diagnostics, but leave fatal errors > intake. In particular, the following should not be silenced: > > * E_ERROR > * E_CORE_ERROR > * E_COMPILE_ERROR > * E_USER_ERROR > * E_RECOVERABLE_ERROR > * E_PARSE > > This change would have two main implications for backwards compatibility: > > 1. Code that legitimately wants to silence fatal errors for whatever reason > should now use error_reporting() (or ini_set()) to do so, instead of @. > > 2. Error handlers that want to only handle non-silenced errors may have to > be adjusted. A common pattern I found in our own tests if checks for > error_reporting() != 0 to detect silencing. This should be changed to > error_reporting() & $err_no to detect whether the specific error type is > silenced. > > A preliminary patch for this change is available at > https://github.com/php/php-src/pull/3685. > > What do you think about this? > > Nikita > I think the need of the @ is to silence everything, and I think is used only in extreme cases where the developer can't handle properly the errors (or the dev is kinda lazy to do it, I have used it a couple of times of course :) ). The developer that uses @ knows his risks and knows that can hides important information for debugging, I don't think that showing fatal error will help the developers in the long term, yes it might help it when is debugging, but later when the code is in production and the @ is still in place I think the developers will not expect to see any error. I don't see the real value of this change knowing the price of lost of backward compatibility. My two cents. Best -- Casiva Agustin Mail/Msn/GTalk/Jabber: casivaagustin@gmail.com Skype: casivaagustin CEL : 054-0362-155280015 Site: http://www.casivaagustin.com.ar --000000000000492b69057bbf5f54--