Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122843 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id C81491A009C for ; Mon, 1 Apr 2024 13:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1711979219; bh=VeEjec+dAYzvid4c0+X8pNqOFrfXqohfR8LNqWM+WAA=; h=Date:Subject:To:References:From:In-Reply-To:From; b=oBYj9ljQlFwrVSPDLO3quOHOdHKbGKr5GtTEB5qjeYlwh4M5EDwsUiKKu86YeFePA +td5eqTM0f/jmdcqOQV/T8ak+kgHcvaeR2l8VW/me0XBGm8upSONpqewjgCA/JuMpW HYUxwlG+Wa4fVLb7LwIxiKg7k5l6au4bTfir3Ccxpu5VTGvDMz8jmC2MEfWu87SwCP UY5y3dZAlxaJ0UMIempHtgyQj1Q+g+iCmFOWndhhFf3jyJrtprQpAxCgcpthBHobFp Uz/XeqUAGNOGUaBFAO4W/5rKv8v2aUXIDk3Z0hlJitQ1fXDv2AbQZWlurgBxj/ageK H8iFs2FzhLcPg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C6AA818007F for ; Mon, 1 Apr 2024 13:46:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: ** X-Spam-Status: No, score=2.1 required=5.0 tests=BAYES_50,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh7-smtp.messagingengine.com (fhigh7-smtp.messagingengine.com [103.168.172.158]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 1 Apr 2024 13:46:57 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 0480711400A5 for ; Mon, 1 Apr 2024 09:46:29 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 01 Apr 2024 09:46:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1711979189; x=1712065589; bh=Epehr0UrVbZCTCAmi2bjcd4JKwfU7dI6VutQ/kh0dlM=; b= G/V8f/Idbw+w/9xpkIu9S37WJbl6SCw93Zww06Evbh6AbmI1ECdQ6JpY8+1qUo9R 8MG0U3qlSlHyKL48+Y3Rfco80jkYxSf+ue4zu2ISpf1d9wbHV3DVzz/wNhwmrEZJ cyVo4EI8NTf55Iz+L5ziaidJMdbfpp0GHpO+8GwtVXjPBPF4yZkQcC6Ct57gVgcd YAY1mvowEAEWXu4etcNec86OszDCAKtLscfbwhM0EiTq6DNjQWkoxXKDbOifjiHQ s8FYLNX120srh2RymgyiaizqkmA+sKf0vOka6zMFp3MnOOjUBrK4Xk4dSoHtk4Zr yvRCq7+tKMiReNM7RNInYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1711979189; x= 1712065589; bh=Epehr0UrVbZCTCAmi2bjcd4JKwfU7dI6VutQ/kh0dlM=; b=m I6riQ9tAJ564JBGExjdNnAX4K1nEy8k2SaY4p2tNVqgISRbMlzFqOgMLR8u120Wl yTopG0x1ny+HxSOwlcCs2kThay+qJA9L5/GxgiVIzudYMrtGPtjmNfszUpOEOkkg LjqxuotSM3OIIeC6bjppE20SZZP3rwFk1nK0g6NT7pPKAFQ7vEWYPx09KoNqEcIB n2s+7bpD/5Bdz9mFoYQwo2q2/ue8yDQCAfocyajquDlStkeDE5qUzrUxEGGe33Kr b4DtoDUYM9SJ9davbcDz6Wv6Aibueo+3b9Y3Z2hOEK1niDw4tP5z95qpeWDUDCjx F6HDTjS6nG3pb4rdtPk0A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeftddgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtke ertddtvdejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhnshculgfkoffuohfrngdf uceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenucggtffrrghtthgvrhhnpe eltdetjeetvdehteffgefgleeviefgveehjeelleehgeegteekheejteeiheeuhfenucff ohhmrghinhepphhhphdrnhgvthenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukh X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 1 Apr 2024 09:46:28 -0400 (EDT) Message-ID: <79d7482b-ad84-45a2-8188-418cf3574086@rwec.co.uk> Date: Mon, 1 Apr 2024 14:46:25 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Invoke __callStatic when non-static public methods are called statically To: internals@lists.php.net References: Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 29/03/2024 02:39, 하늘아부지 wrote: > I created a wiki for __callStatic related issues. > Please see: > https://wiki.php.net/rfc/complete_callstatc_magic Hi, Several times in the discussion you have said (in different words) "__callStatic is called for instance methods which are private or protected", but that is not how it is generally interpreted. If you are calling a method from outside the class, as far as you're concerned only public methods exist; private methods are, by definition, hidden implementation details. This is more obvious in languages with static typing, where if you have an instance of some interface, only the methods on that interface exist; the concrete object might actually have other methods, but you can't access them. That is what is meant by "inaccessible": __call and __callStatic are called for methods which, as seen from the current scope, *do not exist*. You could still argue that static context is like a different scope, or a different statically typed interface - as far as that context is concerned, only static methods exist. But that's also not a common interpretation, for (at least) two reasons: Firstly, there is no syntax in PHP which specifically marks a static call - Foo::bar() is used for both static calls, and for forwarding instance calls, most obviously in the case of parent::foo(). Secondly, until PHP 8, marking a method as static was optional; an error was only raised once you tried to access $this in a context where it wasn't defined. In PHP 4, this was correct code; in PHP 5 and 7, it raised diagnostics (first E_STRICT, later E_DEPRECATED) but still ran the method: class Foo {     function bar() {         echo 'Hello, World!';     } } Foo::bar(); I think that's part of the reason you're getting negative feedback: to you, the feature seems like an obvious extension, even a bug fix; but to others, it seems like a complete change to how static calls are interpreted. Regards, -- Rowan Tommins [IMSoP]