Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115839 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 39347 invoked from network); 25 Aug 2021 21:31:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Aug 2021 21:31:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 71F3D1804D8 for ; Wed, 25 Aug 2021 15:05:36 -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=-2.1 required=5.0 tests=BAYES_00,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-il1-f170.google.com (mail-il1-f170.google.com [209.85.166.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, 25 Aug 2021 15:05:33 -0700 (PDT) Received: by mail-il1-f170.google.com with SMTP id v16so1051253ilo.10 for ; Wed, 25 Aug 2021 15:05:33 -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=3/aDfklqI9m1hj7t2IjV7GkXRz2rtkl4M+pQIYpGtwE=; b=IzNjuwVp1xiUrCqY8FnXSWcG9L8KdX/L8B7o/z4ai7QYjyM2A90zpq7b2DSKCg+HnH XLrw/FOPAGOF1Wo+cRjXHD8UYQfgTGaRP4DBh9z1kCd46eGPY32PLsTrHCRHL0qkh9Os uOHo/LaPM64FCxVOlUCXCm6Xq64x1oAxlpmnuBeldxD4q9xQ5/xdCN91HMq3rSbtSJqj NsMmq5remDP7CO85JxGLEUTc9gdRdVNzI1i9jvsrN7jPah3Ef0ECbYdvxiORet3mCijF x0nUfBjxVOS8ZAsCDHhG5LfNPa/Lj/Plc04iYUrFj7SEZHiwzhZyrY5YFC2Km8H3p1b0 IxrA== 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=3/aDfklqI9m1hj7t2IjV7GkXRz2rtkl4M+pQIYpGtwE=; b=n+CaA5btBpd/I4MFMkvslGXJi8MhH95HE0xgtIXO5HjIlGRWR4ui+zVx2h7oKGbh4a 5vUoyZxg4B1/x8tP/wkipLGO93c5bzZi0UOleyuNpIQGWM3Hy4NG8A6oHpqvhOJfAsB3 7/238uy5oSZ4BvWmDrcMZ8XoQbGevCVeh83M/xJN6Gm6DNAMitxCMRjzcn3xEwhxHWnO Yd8johbhGR3RLyEynG+cJlaHOXUcjspcNTMIgfaIRLGZtjkw7ITpm9KRxJMVp4hTsmdn iILZzavI73DSbWgpGHPjrMrk67Bp52jiiWa9fXCY7EruWi1XKKfUFwAcXrHW7xHRZRrJ XiMQ== X-Gm-Message-State: AOAM530iZAewLWPxkatG8HtDp1j0/6nW42Ky4PE7tifQb3rSHNZtRVPv pTOj2VIqwYDbuYUiUIpV0T9kd5DO+diB9ASpEAopxZk= X-Google-Smtp-Source: ABdhPJxoBiEmMHR/7RkABphJxGuS8TKDDPMgY3m67XItwQObH1N2tl28j3ktD/UsQSPEo6qWmnJrxz0E83dLm1o7VAY= X-Received: by 2002:a92:c846:: with SMTP id b6mr395604ilq.84.1629929132525; Wed, 25 Aug 2021 15:05:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 25 Aug 2021 15:05:20 -0700 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Deprecate dynamic properties From: paul.crovella@gmail.com (Paul Crovella) On Wed, Aug 25, 2021 at 3:03 AM 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-language-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 warnings > with a three-line diff), but may have a big impact on legacy code that > doesn't declare properties at all. > > Regards, > Nikita I'd like to see a section (or just a paragraph) in the RFC summarizing the benefits of making this change. Right now the introduction says that using dynamic properties in modern code "is rarely done intentionally" implying that it's typically done unintentionally, however I can't remember the last time I saw unintentional use either. Is this a common cause of bugs? The internal impact section mentions saving 8 bytes per object plus an unspecified "dramatic" amount for an object iterated over via `foreach` which sounds nice but leaves me guesstimating at real-world impact. I don't much care for dynamic properties, but I also don't much see them outside legacy code so they're not bringing me troubles either. Breaking working code, however, would.