Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110257 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58452 invoked from network); 22 May 2020 18:43:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 May 2020 18:43:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C75DD1804E2 for ; Fri, 22 May 2020 10:22:32 -0700 (PDT) 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,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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) (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 ; Fri, 22 May 2020 10:22:32 -0700 (PDT) Received: by mail-ed1-f65.google.com with SMTP id g9so9804617edw.10 for ; Fri, 22 May 2020 10:22:32 -0700 (PDT) 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=5Sga+29GACGMZduKLD4NaAZ+VSKzT/xRA5aT/7aTpCc=; b=lghYFNeHwSRQzj7+yhmlJmlAIcJIZw4bAcU0HXiXAdHveZNEHvK+orXSIQg35PD33S KuMQtdBi8H//85dlAjn8QEGfd2lrzI70fEEYmg/8r5iVB4ogkcENvtv2JaVQ96PvNS/H rTieC3U465vGCpcU7eETqBZ5NcuoWxR7QGBGxrJY7u71wy5Ut+soke2jP6QqU2vc1PM3 UwWu270nQAshO6VmTTxlCJqvJZLckdOztFWa9ed0XdB/E7DxOIvf3Tub788EL5WCsmAQ jkmIFyd+e05Dj5S4WGoslIu9j3ms3r8oZ2zuatlX4YMpsHIhT2XW3R8jB8EuSqOpY9u5 xCvQ== 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=5Sga+29GACGMZduKLD4NaAZ+VSKzT/xRA5aT/7aTpCc=; b=ibBSp+PrEKnOlUlX4BH3pCBU+GgDkTr+kTJWUZ9TfjuoQ6WxSw3C6v+AIbbAuLqVfM milJJs1RjDwgQp5ahYB8FP6sSxuHTyvSSzd6PkJ0ZO1QWzzuODuVHFh6krnHaWcmcf6R nr9POSk3A+CvmttN1VHSUIkGxALOs42iFmCWv0d2p4sH4wNNKmnWqYHZq4XmL+Ev20Rq OfmthoE80p2It2DpLN4IETO/W18TE7cuIByzSP+0Jpwtjvqyk/oEfNlzb6tAG5AerGIt D+dbbfpldTyII2as+ayvd65JF51JDC+btnkydcvC4/a2ooKqmvZZm9VXjKaAbesb8EAH TQjw== X-Gm-Message-State: AOAM532JUo8ABgsHU3TNB3ssYtcbi7F8G+UEms3PhWNbaGlyiySMKeAN EucFiovpVysvf5LRvSdrwN5MWhvBCV0wJlN1e9Y= X-Google-Smtp-Source: ABdhPJwJZH+wYE3uBKcbyeJs1uk2vn/fWKAZKfwgY8aB3cjmEhQCIPhCbAodrxOgM6OxVeJ4eDqZaRcWG0pgkS5ynbE= X-Received: by 2002:aa7:d787:: with SMTP id s7mr3927891edq.104.1590168148146; Fri, 22 May 2020 10:22:28 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 22 May 2020 19:22:17 +0200 Message-ID: To: Katie Volz Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000009a7d7a05a63fdfc2" Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Error Exceptions mode From: george.banyard@gmail.com ("G. P. B.") --0000000000009a7d7a05a63fdfc2 Content-Type: text/plain; charset="UTF-8" On Fri, 22 May 2020 at 18:09, Katie Volz wrote: > Hello internals, > > I want to start a discussion on an RFC to add a declare() statement to > convert all errors triggered within a file to exceptions. > > Currently, the only way to handle notices/warnings in an exception-like > manner is via set_error_handler, (for example, example #1 on > https://www.php.net/errorexception) - however this has several > disadvantages (in particular, it cannot be safely used in libraries without > affecting other libraries). The declare() would only affect code on the > particular PHP file for which the declare was set to 1, in the same way > that strict_types only affects code on a particular PHP file. I have > listed error_exception, error_exceptions, and strict_errors as potential > names for the declare(), although I don't feel that any of them clearly and > succinctly describe what is happening here (if anyone has a better name I'm > certainly interested). > > As I do not have wiki karma, I have posted a draft RFC here: > https://github.com/iggyvolz/php-rfcs/blob/master/error-exceptions.txt. A > partially complete patch is linked at the bottom of the draft (very much > based off the strict_types patch). > > Thanks, > Katie Volz > I did a similar PoC last summer (see: https://github.com/php/php-src/pull/4549) where Nikita commented that a lot of those warnings could/should be promoted to error regardless, and this is what myself and a couple of other people have been during for the past year. There are still extensions which didn't receive this treatment mostly due to lack of time and hands, so if you want to join on this feel free to send a PR to php-src Due to the work already done, I personally see less interest in such a declare. Mostly because doing a promotion of these warnings, which are usually tied in to a failure return value such as null or false, allows us in some instance to "clean" up the return value, but only if it's done on the extension level/in core. Now I do acknowledge the number of E_WARNINGs still present on master is large, but I'd personally prefer to focus on making the language better for everyone and let legit warnings be warnings mostly due to the legacy behaviour for I/O operations. Best regards George P. Banyard --0000000000009a7d7a05a63fdfc2--