Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112374 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 15838 invoked from network); 2 Dec 2020 15:28:35 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Dec 2020 15:28:35 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C44DE1804C3 for ; Wed, 2 Dec 2020 06:56:17 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 2 Dec 2020 06:56:17 -0800 (PST) Received: by mail-lj1-f170.google.com with SMTP id i17so4086587ljd.3 for ; Wed, 02 Dec 2020 06:56:17 -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=bVGr8C621J0FDl5rtwKWmJJeRAqbZ3dj4JxRqW4I5Lc=; b=DvEB+0y4G5P/r995NPmbjMlJT4q/u9UZdjMZZSmVCMWeW2GMn4XVILfXJ1NHx/IAJJ EHmGfw3NruuOoqXmrNHj38j2yDroSYo51gZiCAu2Kx2gotDJClnXqPTnbCr3cdzMFBeD gQa838uvbEFMjqHPrb3Ygt08pTav9mN0PSp4cooTmW9eOfgH0sXQhnPk6xe64jDFSlZm jWBMP+LaxIz+duHGKrHrG9UpeTs5P8JbZ+/dIJu0cas+tadXM5cVyKQwODgxaj74WNB8 VqEFAGiSubRzB+bK0JaaBX3qKvS5yO5T9USF+fXZJEXlnzxRk3T6tZHCuQuREF1bh7kW kOAA== 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=bVGr8C621J0FDl5rtwKWmJJeRAqbZ3dj4JxRqW4I5Lc=; b=VieXau1NVX2WgG2qo2uj5P9Vl4+Ba1eeiEa2XhGQYn18MgdHmUoX0v6flHyo5y+Eg4 uAXJ2E9l2f0/hOGuyXAZP9n5PBXRSKe3gwLN3jPc26Ew6DQgZr6mJl99mfcCwTtAOIyQ h1Pk0AAs4e73zxKESAc91dewPWAIhhh3yoY1/yMsUd62hN/Fznt5lg1ybB1CBS+Rnmlj FfFfcOIPnNjHkaCBew8Utf7xWzlzdxRnATrTDI9joSXg+xOhaVPVj0OoZEYgtc+yI/8a DMUzV2pjmVIgtkRT21pq47/QLlInvgItOM+WfmR4KiuDy7ML8hbQHvNROK/T5Ttg4sKj aZqw== X-Gm-Message-State: AOAM533ispTY5QZK30opErppg1FhBf1Wd3VpSh3qsFQeramufVfgYqLI r53xj6Lc25+jdTNqkogR7Tj+L0W22Kc5OWbGLds= X-Google-Smtp-Source: ABdhPJzfJEANyUnH7/DBd3u0kWudqzeZqNuI1rRK8FE49saxg0m+4LU5UzrkYGzP6XfxU5ecFHcPyuwdcvoWXcvr32M= X-Received: by 2002:a2e:814a:: with SMTP id t10mr1366515ljg.30.1606920973369; Wed, 02 Dec 2020 06:56:13 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 2 Dec 2020 15:55:55 +0100 Message-ID: To: Benjamin Morel Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000ccc62005b57c71fc" Subject: Re: [PHP-DEV] erorr_reporting() and @ operator From: nikita.ppv@gmail.com (Nikita Popov) --000000000000ccc62005b57c71fc Content-Type: text/plain; charset="UTF-8" On Wed, Dec 2, 2020 at 3:14 PM Benjamin Morel wrote: > Thanks for the pointer, Nikita. > > I think the updated example (using `error_reporting() & $errno`) fails to > mimic exactly what `error_reporting() === 0` did, though. > > Say your php.ini mutes E_WARNING, for example: > > error_reporting = E_ALL & ~E_WARNING > > Checking for `error_reporting() === 0` allowed to only ignore @-suppressed > statements, but still throw an exception on E_WARNING, ignoring the > error_reporting set in php.ini. > > OTOH, checking for `error_reporting() & $errno` still allows to > ignore @-suppressed statements, but **also ignores E_WARNING configured in > php.ini**, which is not always what userland code wants. > > I'm not sure how userland code can now replicate the old behaviour, i.e. > specifically detect the @ operator? > First off: Please don't do this. Error_reporting should be respected independently of how it was set. Now, if you do want to approximately distinguish @, you can do it the same way you did before: Check for the value it sets. Previously that was 0 (which you also couldn't distinguish from error_reporting=0 set in php.ini). Now it will be E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE, or whatever that evaluates to. Regards, Nikita --000000000000ccc62005b57c71fc--