Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116386 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16014 invoked from network); 15 Nov 2021 17:32:54 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Nov 2021 17:32:54 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D9780180540 for ; Mon, 15 Nov 2021 10:27:39 -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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (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 10:27:36 -0800 (PST) Received: by mail-pg1-f176.google.com with SMTP id m15so11417730pgu.11 for ; Mon, 15 Nov 2021 10:27:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6VAiSCi7TS1hIb9Tcx6NUG/2Q3Hf3xBL9FcHgQQKfvY=; b=bx/huNxZ3uWwtniUaAwxQMlh3tzVtfL4F4BHpWbbkcGmY3dfZjPD/I+QYi/UonX4nd 1pywZ/5w52lFEX45iJlCgnXblb+bL7KEunbceR/Ql4HCgtqQEYOOBW0yFObeUqerLA0P uMVEHaTs6O6crRYoo6WcFgib3ZhRJ7JXHXjJuGa7odO1qWf8jXXHcn7Aqiei/UrZZxzN xjjQiCw96jFqOe3F22ASq4m3tV5Hy7hTnpJK1V+IENbdvHfdsSL/LcGu8tuwDMpoE4f5 ELPQllsVzR4txbPJGQ/iC68dp+n34xlMJg84+mvQo2QF+UNwR66ernnMXYMqGfkgpx+h WzIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6VAiSCi7TS1hIb9Tcx6NUG/2Q3Hf3xBL9FcHgQQKfvY=; b=4zD5c0suXIzfHk1J5evq5v/GoHyMYPLgrqGKzpjSaV1xh+/Y3t+3UpZ2Nj1knGUjED DkZyI6fH7Yj6CjT2u/pSrKRPz3yPTG0m8t0OXTHqy3p9s0xnSitG8ieA5cM1cQFtVrfS G9JAkNmuCYWk/MMbKaMbjB/nGXqKTv5AyDpyIjnOBK6/r9d8JOvIRer0l+uePYM3Ffru P33crVARtOXMRe2xCEZqeJryFMxEDlv2jGkdaNSmhyhq/DUui0L4a18Ja3fmlSkROKeW Io/b937lZFagw+41Cc6wXPYjJdSbqhpuu9HchaSVp9olj4xLRvHl6Kqnd3YXzAR/jmd9 ui+A== X-Gm-Message-State: AOAM533LqY0T2/MBSrUvknuz21bQk7ptJ1AIQj2b6DqDyy3O8RiecYZ6 aOfjN/arWQk/2zMs6gKzCHrngrGbB8fE1vFUAu12migvzKbnAg== X-Google-Smtp-Source: ABdhPJxSef6OFK4PhbW7RZRbpBqLz1fk10l8Z79ZngRfV9tx8YYv0XZ4iTgfl4fpW1MyI1kgzqhoyMwTGYIQejNX0sc= X-Received: by 2002:aa7:808e:0:b0:493:f071:274f with SMTP id v14-20020aa7808e000000b00493f071274fmr34549210pff.37.1637000855218; Mon, 15 Nov 2021 10:27:35 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 15 Nov 2021 20:27:08 +0200 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000078edae05d0d7f64f" Subject: Re: [PHP-DEV] [RFC] Deprecate dynamic properties From: arvids.godjuks@gmail.com (Arvids Godjuks) --00000000000078edae05d0d7f64f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Aug 25, 2021 at 1:03 PM Nikita Popov wrote: > Hi internals, > > I'd like to propose the deprecation of "dynamic properties", that is > properties that have not been declared in the class (stdClass and > __get/__set excluded, of course): > > https://wiki.php.net/rfc/deprecate_dynamic_properties > > This has been discussed in various forms in the past, e.g. in > https://wiki.php.net/rfc/locked-classes as a class modifier and > https://wiki.php.net/rfc/namespace_scoped_declares / > > https://github.com/nikic/php-rfcs/blob/language-evolution/rfcs/0000-langu= age-evolution.md > as a declare directive. > > This RFC takes the more direct route of deprecating this functionality > entirely. I expect that this will have relatively little impact on modern > code (e.g. in Symfony I could fix the vast majority of deprecation warnin= gs > with a three-line diff), but may have a big impact on legacy code that > doesn't declare properties at all. > > Regards, > Nikita > Hello everyone, This is going to be a bit wordy, so sorry in advance, but I want to set the context correctly. As a userland developer, the overall idea concept I agree with, but the thing that irks me here is that this is opt-out. My day to day reality is dealing with complex big projects with codebases that go into 5 digit file numbers excluding the ./vendor folder. The projects are not legacy projects - they are being updated and are actually run on 7.4 in E_ALL mode, we just finished upgrading it to Symfony 5.3 and are going to go full PHP8 soon. There are parts of the project that are older style code and we update those as we go - we actually do have tasks assigned to team members to specifically update the code, so it's planned steady progress that has been going on for 2 years now. We are not a small dev team too, but we also have our tasks to do features, fix bugs and in general keep the system running and evolving. Most our code is strict_types=3D1 and PHP 8 ready. It is going to be a major undertaking that would halt all work to migrate to a newer version of PHP where we need to inject the allow dynamic attribute without hitting a brick wall. It is not even going to be us, the developers, who are going to have the biggest chunk of it - it's going to be the QA who are going to have to go through the whole project and identify all the issues that crop up. It is a complex and big piece of software that has been developed for the past 10 years - there is no easy way to do one-shot big upgrades without prior planning way in advance. And while we can certainly deal with it eventually (and stay on older PHP versions for a while) all the 3rd party packages that we use are going to be an even bigger pain to deal with and manage. If a 3rd party package combines fixing major bugs with a release of a significant version and including also the new attribute that's available only on newer PHP version? You end up in an "all-or-nothing" situation. I hope I do not have to explain why this is not good? This also goes against the general way PHP has been doing the strict stuff - you opt-in into typed properties, arguments and return types. You also opt-in into strict type mode. Feels like this should follow the same approach. If we are talking about having a blanket depreciation and then a fatal error like that, I feel like it should be part of the `declare(strict_types=3D1)` mode for the simple reason that most code in the wild is not really dynamic when the developer chooses to run in strict mode (and a few cases where they need it - the RFC shows good ways to convert the code). Meaning chances of things breaking in a major way and requiring a lot of work to update the code. Automated tooling is nice if you know you can safely do "all or nothing". In complex systems that are ongoing projects where you have to balance progress with upgrading older parts it's rarely that simple. Something to think about and my 0.02$ on the subject. --=20 Arv=C4=ABds Godjuks +371 26 851 664 arvids.godjuks@gmail.com Telegram: @psihius https://t.me/psihius --00000000000078edae05d0d7f64f--