Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113257 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88835 invoked from network); 25 Feb 2021 09:24:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Feb 2021 09:24:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A48521804B3 for ; Thu, 25 Feb 2021 01:13:17 -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-Virus: No X-Envelope-From: Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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, 25 Feb 2021 01:13:16 -0800 (PST) Received: by mail-lf1-f54.google.com with SMTP id u4so7525233lfs.0 for ; Thu, 25 Feb 2021 01:13:16 -0800 (PST) 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=sQT1uZOxjwcnwmUFl8lF58xQCv7PSL460MsftPLHXXM=; b=E40ebw+gmvxrMLC2CVfXEn50AXSmyfPNC7QNiqYjfZGzCqShKwz/Ce7ni/seKMwryG VeLXN6cplP+BBnZ741zgG9mkfmBWyBT/IhgFhIgZRmkl1D2VAiSBuwiIMXge+0YMpAAO 7MRXyPplek6CVNdfn4fKKQZrS/uCYQ1IUqA7Kqe+2QS3o3wbSVVqC0u6+pwqLk1xqkJZ Ez0fnT4F79L3WrnjDO67j90AnnK0PIIG/b7mWrArz7ZEAsaph+baQvO4acksfGfnw6IM oSEUsVsn+xpWqmdQlSW4r6kdpwf+/rlyzJD+GA5sioWKQb6wcsta2uDkqq3pkQIpLkC9 15vQ== 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=sQT1uZOxjwcnwmUFl8lF58xQCv7PSL460MsftPLHXXM=; b=Qi9W7maVfn8oPTTJbUAD7HC2m+EiAZmAUETuzeabWN9sO54BDKYwAT8FpXRbdEgQOk vwtNkZdJQ+y9AepkjvanMlkyAb7naf+aJVL6PRUt4aTNHAt+ydU/SkpS40thlTeu3hZa TdP5LZNobybYmBdnKw3aALWrSDUgqgkRAMpLPkG340eDpwSijiBcjB549s4HJwjN6RcO FWGdS2W1n4lY4XXk0AKwnt4RH4+nmQT2QGfN4fyeg588pNPCwel71OayYxsUdBmEqj15 HZsgLG0Udzl8es2nLjthViFzQrgeE6AhLCqWfm1Bp47/m8bU73Aph0fkNaE3e8MldIyI qGyg== X-Gm-Message-State: AOAM532+ktTTvsyumrullpnNc35kaL83HRCu1KtrlaoOpXnMKb5P+au/ b2cW3RfTdk1C0cs6UmKWU8YqE4WREuYIGNwc+UKq9vmoKEwLBw== X-Google-Smtp-Source: ABdhPJyOYYSA30R9lP5RwSeGQgBr/8MmGNqL+hOvSQGCJBS0t2mtBvkbBpgmzFuR6SE96/dsp0y5vHYMMGNySaS2rW0= X-Received: by 2002:ac2:5df6:: with SMTP id z22mr1428959lfq.485.1614244393959; Thu, 25 Feb 2021 01:13:13 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 25 Feb 2021 10:12:58 +0100 Message-ID: To: Aleksander Machniak Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000aec39205bc258f77" Subject: Re: [PHP-DEV] [RFC] Static variables in inherited methods From: nikita.ppv@gmail.com (Nikita Popov) --000000000000aec39205bc258f77 Content-Type: text/plain; charset="UTF-8" On Thu, Feb 25, 2021 at 9:48 AM Aleksander Machniak wrote: > On 23.02.2021 15:01, Nikita Popov wrote: > > While looking into various issues related to static variable handling, > I've > > become increasingly convinced that our handling of static variables in > > inherited methods is outright buggy. However, it's also long-standing > > behavior, so I've put up an RFC: > > > > https://wiki.php.net/rfc/static_variable_inheritance > > What about non-static methods with static vars inside? I think it should > be mentioned in the RFC, that it does not matter. Or the examples should > not use a static method, for clarity. > Thanks for the suggestion. I've explicitly mentioned that the behavior is independent of whether the method is static, and added an example. > I'm not sure I would agree with the Traits behavior being consistent. Yes, this part is not so clear cut. I think that intuitively, this is the correct behavior because it makes static variables work the same way as static properties. An additional consideration is that it's possible to use trait methods multiple times in the same class: