Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103529 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 75492 invoked from network); 29 Nov 2018 08:20:30 -0000 Received: from unknown (HELO mail-qt1-f176.google.com) (209.85.160.176) by pb1.pair.com with SMTP; 29 Nov 2018 08:20:30 -0000 Received: by mail-qt1-f176.google.com with SMTP id n32so625727qte.11 for ; Wed, 28 Nov 2018 20:44:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=voE4UqPYpe3klRga8/RLjLZmgmQhaZWi5AIGXNCET5o=; b=qygXzkvR+qTtvqhJeQyyx6rDXP2rBAeiPikQfKolSWkNk+WN0Iejp94zq3EAmy9qvJ kAtft8o2BOWbZ+YVTyWHg6FkAlxT39eLeLS63im2jD3/imZDJG+sB1ypljj/kZUth9y/ 4KTsUgMOvhPzv/PWi42a1stbtZFrL7AnNqok0oTutj/w8F7V8GOc1c5bnYJ0fwP5woUW EnpPBrLxUW8zqjj/sMRtQ4c44+fgi4DfI8tzkSdtrfxB6tqYEnPyKEgeI2+0chWDLdlQ GK94bYTclxn9fXSWz6T3D1JcbhRUQdRYk1d5H+9payJecs6kiqSDSjPGFHUZpZXRhNfj 3Ozg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=voE4UqPYpe3klRga8/RLjLZmgmQhaZWi5AIGXNCET5o=; b=dLnkI938EVNA/cQeED4CZdICMAjMOrfybDL5UhpHiitriyscJDo4MTaVFIBGH8ugKZ Gc5u4UAmJa7E41aPfFBMc/9xdN3U/vwhqaLaW3W+LnOs7Eyvphku1u/iHI/2glC0O++K mDb+48yQwQeZJmlFgKr2E/NQnxTNIITC97hLTqPiZjFzN5EIzXVSfLPIOnxG6/tsdWQ8 8PhtgIW3FemVx31jP9QhZMr753fTewTlUjGJC/wlwRVfJGL2eVdMw9cymX/+E6ifSJFT VpmJbln30+DKesiQ9YNUCG7DIfZrFHH2BMO6rVmcSxZo3IAiM/C+GEHhm0/qUy0yx/X1 gYmg== X-Gm-Message-State: AA+aEWbEM0gAqWdYx8d+Emo7loLpXupSBnf5Rj0TRrfHqJgkN1Owsi+0 sQAz8rDZT6Jya0hVdbNeV28jWvR3WRPMZnI/8Uo= X-Google-Smtp-Source: AFSGD/WB42RzE7BqVOZWPLKKmbL3py89wLBgWZW6kBvYkRFNWHcVb3lo3yA0q880YGkqzgEDSl+kHB7Qsm8nQLuo25s= X-Received: by 2002:aed:2ae3:: with SMTP id t90mr16014qtd.19.1543466673129; Wed, 28 Nov 2018 20:44:33 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a0c:f1d2:0:0:0:0:0 with HTTP; Wed, 28 Nov 2018 20:44:32 -0800 (PST) In-Reply-To: References: Date: Wed, 28 Nov 2018 20:44:32 -0800 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Don't silence fatal errors From: fwentish@gmail.com (Fwentish Aelondes) Breaking BC might be unnecessary if instead of changing the default behavior of @, you add an additional flag to error_reporting that enables the new behavior, something like E_UNSILENCE_FATAL. Then developers would only need to switch a flag in php.ini to get the old behavior back, instead of re-working existing code around the new behavior. On 11/26/18, 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 >