Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116363 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 64361 invoked from network); 15 Nov 2021 10:39:31 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Nov 2021 10:39:31 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8FFCC180545 for ; Mon, 15 Nov 2021 03:34:12 -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=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 ; Mon, 15 Nov 2021 03:34:12 -0800 (PST) Received: by mail-wr1-f43.google.com with SMTP id w29so29960812wra.12 for ; Mon, 15 Nov 2021 03:34:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:content-language:to:from :subject:content-transfer-encoding; bh=2fxnQ30iTQddwsiEjJrhkzqUJXLecR8nxMrfce6ka1o=; b=CBCk9815wWpGfYFfH8BqMswpMnhMj0UA6p0t7C3V2+xcCFfYvIIDGT04QRZP/gqNiR fJPH9pJqoQANk0xg59fIQjIVhPAMsCCetJo4FR44CawdAoI7Tz5VjXohM59cImZLDhZ3 dZ60p/UQ1yxW65CVhiZZIDLN7KaAzzYORQ9yi0rNW7iR5FV0YIjrWBFHToH4mjj3L2vn BDfi54nH+d4QX7Hm4xT9SvAoH4wacnAEHtXE6DD2KZ7lQFTCH3uabIbeiQ4q3LPvJoJa T1AvtKL4tLu1XgpKg9P8LcPdZxbc+6l2tsBAclts3DcFSGNmcNyModr/eFoSWb5cNpPW hiGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:from:subject:content-transfer-encoding; bh=2fxnQ30iTQddwsiEjJrhkzqUJXLecR8nxMrfce6ka1o=; b=NxlSVqbkmRgmidKRI3Y+lj3baSNfXKPZDefIbc0NIwUKFeBi5ejNi24qqQtM74U/BF debmPpQb3xY8MMyrMF4I7GffyBNlSOMPV2BDekHm6cXlpeQvWzptzgQAAzztkrqa66fz vMqOf5E83+tZTykma5P9PSvf4vFFoBeSRp/3S293cUMJtCxfSvFekigLrw9d+DKjpk3V FlDggbS6Jr6Lw7+2qUyV8FACZFEn2yWtwaeppZInNJXEnECpog7Q8U/9kY92wPWdSQYd UE0wkDDO5pcCUCyjeOEkGTfe/v220kKxOB1XuGJ46gHCV6YcN/0TaMiZrOkc+f4mkUXY njQA== X-Gm-Message-State: AOAM533KXHc/PQyRzN9A4R7hwLOHibqemcpCl6fEEdzqhUsFt2zDNb7k L1GvX9whl+Et3E0OJf8QDJ64B9e+Hr+dJA== X-Google-Smtp-Source: ABdhPJws0QipRof73oypdxAyjJk4tPFx6utMQkLv94vIgTSPqdoC5j9PG+kfcomr88c2ZC5hzXoeMg== X-Received: by 2002:a5d:5986:: with SMTP id n6mr47593565wri.297.1636976051013; Mon, 15 Nov 2021 03:34:11 -0800 (PST) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id i17sm15380033wmq.48.2021.11.15.03.34.10 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Nov 2021 03:34:10 -0800 (PST) Message-ID: Date: Mon, 15 Nov 2021 11:34:09 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Content-Language: en-GB To: PHP Internals Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Finer control of diagnostics (deprecations, notices, and warnings) From: rowan.collins@gmail.com (Rowan Tommins) Hi all, Concerns have been raised a few times recently about adding new warnings and deprecation notices, particularly: * That code bases with many instances of a particular pattern see a lot of noise when a message is added * That library maintainers face pressure to fix deprecations from users who don't want to see those messages in their logs I don't think "stop adding new diagnostics to PHP" is a good solution to these problems, and have thought of two ideas which might improve things; both need refinement, but I hope can at least act as discussion starters. The first idea is directory-level error_reporting configuration. In principle, this would be very simple: a mechanism (ini setting or function) that lets a user specify a different error_reporting level for all code compiled from a particular directory. The most common use I foresee is reducing reporting in third-party libraries, e.g. error_reporting=E_ALL error_reporting[*/vendor/*]=E_ERROR+E_WARNING This would hopefully reduce pressure on maintainers to fix deprecation notices as soon as they appear, because they would no longer be cluttering the user's logs. The second idea is diagnostic codes or categories. This is more complicated, because it requires classifying all existing diagnostics to add extra information, but would allow users to act differently on specific messages. They might suppress them, downgrade Warnings to Notices, or even upgrade Notices to Warnings - as they might with rules in an IDE or Static Analysis tool. As an extension, the @ operator could be enhanced to suppress a specific diagnostic, so that the following would give an "undefined variable" warning, but be silent about the file not existing: @{FILE_NOT_FOUND}fopen($undefinedVariable, 'r'); Regards, -- Rowan Tommins [IMSoP]