Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110066 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 97400 invoked from network); 7 May 2020 11:43:45 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 May 2020 11:43:45 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4AF4D1804F8 for ; Thu, 7 May 2020 03:19:09 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE 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-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 ; Thu, 7 May 2020 03:19:08 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id k1so5680808wrx.4 for ; Thu, 07 May 2020 03:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GoDJUKxu8Di5tyGr869wZeoYzngjcN/EgvxtXIJJ0+E=; b=sM7qwdpyKShp9xvm1HMuyJSoUMEafBrpo/vBLScB0Yf6oOqj4Sh24vWqjAPKvzSUla QDW0yU/t+rflcQCcRVPpVtWpN6cv/xutEX9wm9gTWnfeRP/7ium2ArFCB0oG3cy0aeUT H2xU7TjAGJJ2J1/jBXLhHlBvmwooVwFwDpfmpMqG0Z1lOHe8LY8wssQr8SiUtaTfTF4a kxCjkRX8T4ZLuvlCaczNSJFSmhXgdXeQiWYRsgbKkcg/DZLtkpiaoYXOL9ZPNJKM9zDn zrGQfksHW4LpjPWW1Wm8ftFFvlTh+GMPbA4gswQfAqUmPpP8mGa7e/Dxfak1bKHSFa2J GYOg== 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=GoDJUKxu8Di5tyGr869wZeoYzngjcN/EgvxtXIJJ0+E=; b=U62A75UGIB1DIyITs1akxANUcr2jSKAyTUCwWc+SrarZZ6jVi2ub3m5ysDTTSkO6gg t6Tqy0iOax+zl6XTrRZdtECJtvzCWQMHTA6JDTDR4TAiH97YGgBfeYgAPa5QBKk/yiww rCPTaF9snWvpsAkHln0QGXOYMvFq7Hxsf9qdG3Nq1CMhsLlx3sBOOOWOdFxwwTj/ICdO moJ8QecsAgDXHI0PttXoYLz5Mxf6hPAr+5QPtjMFiZln5moZint4lDJdMBZWVBK6475c ZJUJzr/InxDP07GTDGcyyrQNHdONTvx3mhKIIisefoMNUbS9NPSXxGAn/HxYIG7Q6tBs hRvg== X-Gm-Message-State: AGi0PuZiw7VrIocEGrlX627J1IHM9OUpyuVrq4Imv2wGC8P9MipK+6Qr rAdaRWGcNvLX36oEBH6gjjqn3dUanOBVKmTszAhDeA== X-Google-Smtp-Source: APiQypIMwpy+kMRyG4Df+K8n2FGXEAkAVissACuGEBb/PKUQGr++X1arZ177RqH0iqqh1ccOSzSvYmPwcq7a8ocdfUE= X-Received: by 2002:adf:a1cb:: with SMTP id v11mr13826057wrv.39.1588846746733; Thu, 07 May 2020 03:19:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 7 May 2020 12:18:55 +0200 Message-ID: To: Marco Pivetta Cc: Davey Shafik , PHP Internals Content-Type: multipart/alternative; boundary="000000000000f12b7505a50c35fd" Subject: Re: [PHP-DEV] [RFC] <> Attribute From: kontakt@beberlei.de (Benjamin Eberlei) --000000000000f12b7505a50c35fd Content-Type: text/plain; charset="UTF-8" On Thu, May 7, 2020 at 10:54 AM Marco Pivetta wrote: > Hey Benjamin, > > On Thu, May 7, 2020, 10:42 Benjamin Eberlei wrote: > >> >> This attribute is "reflected" by the engine during compilation, userland >> doesn't have to reflect it again itself. on a code level the engine >> "patches" each function automatically, this would do the following at >> compile time: >> >> @@ -1,6 +1,6 @@ >> > >> -<> >> function foo() { >> + trigger_error('Function foo() is deprecated', E_USER_DEPRECATED); >> return 'foo'; >> } >> > > Already discussed it elsewhere, but I don't think that adding more runtime > side-effects, especially on otherwise referentially transparent code, is a > good idea. > > Very much against the current wave on `@trigger_error()` wave that symfony > introduced. The rationale behind that hacky/messy approach is that > sometimes deprecations are not determined statically (for example, if a > specific parameter **value** is given), but I see no reason to do the same > for static references. > While I agree with you on @trigger_errror, this is a seperate issue. PHP itself triggers all its deprecations with trigger_error(..., E_DEPRECATED), so this feature should do the same thing. I started a discussion about how we can improve error handling in general here: https://externals.io/message/110000 - first with some internal changes. Based on that userland changes are the next thing that should follow, but need a lot more care to avoid BC breaks. > Since this would declare deprecations on static symbols, it can be > detected statically, not at runtime. > > You will also get deprecations for very deeply nested components, which > are transitive dependencies of what you effectively use in your sources: > seen that in the wild already, and it wasn't a fun ride either. > Based on <> there is at least the chance to avoid transitive dependencies, that means preventing deprecation errors to get triggered, when we are already in a deprecated function that triggered an error in the stack above. but I haven't investigated this further yet. > > If you still want warnings at runtime, you can plug in something like > GO-AOP-PHP, which kinda does exactly the same thing, but opt-in and not as > a standardized side-effects engine (bad). > You can always disable this at runtime by removing E_USER_DEPRECATED from error_reporting. > > Very similar PoV of Davey: since recently, we have the static analysis > tools; let's endorse static analysis instead. > >> --000000000000f12b7505a50c35fd--