Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104188 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76301 invoked from network); 5 Feb 2019 18:35:53 -0000 Received: from unknown (HELO mail-it1-f178.google.com) (209.85.166.178) by pb1.pair.com with SMTP; 5 Feb 2019 18:35:53 -0000 Received: by mail-it1-f178.google.com with SMTP id i145so9170526ita.4 for ; Tue, 05 Feb 2019 07:17:03 -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; bh=9a97Arc8WsKqda524+a33woZ/10ctBV7z+Scgx+Su6I=; b=RwSMrYihSJv7hoV6NXullP8b3Xh/SXP7G/6315cTwRiZVVW7Sq9606Q1eR8UOt12Jl AyJD1tWK7AhWmt0PvPv57hsL3nBmEUinDoQGtt+/k4b0ZY5IkK120w6qPy2cAKM1EL71 UcOWg0MnRxiZ2xjaszw0meED+K187wZDCJ+abkxxNhxSkV+6HO9B8V/FxeHX95T1YRpx MS6WO2DF26bVMTjcC+65pMXq/caRnbiAIrSnAKeVbFDE83nXhNTorAPlF0p9YfxtP3E5 9RYlYaAxZy4UjE4fT4YhNYtONPgVRpvRQv0Y9fnu/9UMTW0qCoSuMVMIx258/IUl815z 7mFw== 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; bh=9a97Arc8WsKqda524+a33woZ/10ctBV7z+Scgx+Su6I=; b=RMPwx83ZE92OCQsoAVlh99NtfgV3238C3q1F1XZUBSUevAE27OHw+TEXKecy1O4nIn Q4xk6PICmnMJH3LWrYyqSlsHmu6FPFsJ/QR6UHlr9WAW8TYJBsBYC5xRxarVvvKPFzA1 eHxHZa405ALWJ82B5wIdAl6yug9Z7HPKUAQS4AIYZAk0ILqST8O+KGb9263sAPvAJqV7 I8sBAci1yvWCrDN3bfe7dcQt9BxVNE3LCEcC9ooyRyKg2oQ6e+/OISA3doUTkVurNDMC XBuNS+r5LD/cVZKp7gvdUcz89kbvdLSkujjNDof9ii7YGhG29+AhfAHQP3kF9vbtM0WL cRnQ== X-Gm-Message-State: AHQUAubvaE5LaqzDEJ4WAhB+5tujsgjjNpKOQUr8v64CVTcdtKC6iToJ A4iOCbtjbWhmUnxq/H7u8bmH9xXA0v5JEslGeBWBlA== X-Google-Smtp-Source: AHgI3Ib6FBTWwdy+aqflcJYqgArPcs0pp/dDosGCv7LEoP//Sy8iKEVn4kV+RIkG9ZY8d6lgvRKXHm5Hkv13LnJQQ4E= X-Received: by 2002:a5d:88d3:: with SMTP id i19mr612248iol.187.1549379822191; Tue, 05 Feb 2019 07:17:02 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 5 Feb 2019 16:16:44 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000ec90f205812719ed" Subject: Re: Don't silence fatal errors From: nikita.ppv@gmail.com (Nikita Popov) --000000000000ec90f205812719ed Content-Type: text/plain; charset="UTF-8" On Mon, Nov 26, 2018 at 10:42 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'd like to move forward with this change. I think the overall reception here has been positive, although in the discussion some other possibilities that avoid/reduce the BC aspect have been discussed. I think now that we have a PHP 8 branch, it would make sense to apply this as-is. The BC break is quite minor (compared to the other changes in PHP 8) and I think this is the cleanest way to solve the problem, as it only changes the list of silences errors, without introducing any new error handling concepts or mechanisms. Nikita --000000000000ec90f205812719ed--