Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103513 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 42290 invoked from network); 27 Nov 2018 01:19:44 -0000 Received: from unknown (HELO mail-io1-f47.google.com) (209.85.166.47) by pb1.pair.com with SMTP; 27 Nov 2018 01:19:44 -0000 Received: by mail-io1-f47.google.com with SMTP id k7so5382705iob.6 for ; Mon, 26 Nov 2018 13:43:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=lzn9icLh5dT6K+Cpr4JTQjbnxhE4B446Hf0qOl5Xy18=; b=UVYOLNpi0P7TqFbP2QFikOhyt+2U+gz/UtYwK94PM8h2QfxJmnkzasOEsE9aGfCeYF iJC5oWwsQej5DAfumJS45ccLDz8+9MV87NqDKMpddSc3Jg+gvbn9TGqu69nEEdEl1N/T XCwXpEJUp+de9zF2NpfX6N6H/kboXwRU0ouYrCcl9+0NqhLJLh6oiNlgqnZMtnyUh/BH Qdoa3TWD1D/KdWTPvCM13UpKHgi63Twqq7wbVldZ+lefQhXDwlJzlRDzS/p53fGkwDHA LBg52Eb7GEuPl2NrljhD/A4SivXZ6som9nFnR7rC050a8C5t7yasM4rpK84FWXpwzBTZ HiVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=lzn9icLh5dT6K+Cpr4JTQjbnxhE4B446Hf0qOl5Xy18=; b=KS3kn0HFX+L1ecjimsW39hV21lY7EAMvkUoMVuk7JiOCfLg9q5OZSkteJAEre5975N mgjit0O/RXENulS8huIXfOOtoKR+e9RLfMKIRpkHby80HfQr9tIWaiHFTZc71+Kg6NPi cz/25xIWFGLIIxYLXnxy43pJX/r86FxIhkFuIZuDqBIxicUGnU4en9gr29nguPqhPYsu j73StaywYsipNbaqtJxe0kzJu1qbbkI3tumb57LV2S6s5koheLKf2E5nhQJVb6cLIzvd dgpd2s5HIe+JnKVa5dR1pzWnyp6PEpkYsgavd7kywd/jbny8kSTa8wQdTKxQRO2n/0Hn ELWw== X-Gm-Message-State: AA+aEWbSzm92XU/HlV4chFS2P8hWa9EvpdJeBaop5IQstAko9uOy+xnc SQzpOavsk2lPvsjqzvSYIF69PGXaicqtDqD9O3aOkOSB X-Google-Smtp-Source: AFSGD/WCvFVQkPTR4Th4Dc5jC3vIoY5e0SqXBbiGVbCgCdDyD0lnxzJ4IJSN5k1iU/ztly19k9qluoTjk7Klf8/JHtw= X-Received: by 2002:a5e:8d13:: with SMTP id m19mr22492517ioj.258.1543268592442; Mon, 26 Nov 2018 13:43:12 -0800 (PST) MIME-Version: 1.0 Date: Mon, 26 Nov 2018 22:42:55 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000003ee5dd057b9838d7" Subject: Don't silence fatal errors From: nikita.ppv@gmail.com (Nikita Popov) --0000000000003ee5dd057b9838d7 Content-Type: text/plain; charset="UTF-8" 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 --0000000000003ee5dd057b9838d7--