Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128303 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 lists.php.net (Postfix) with ESMTPS id 63C8F1A00BC for ; Tue, 29 Jul 2025 18:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753812608; bh=Z3r+u3BNcz39NcyxUXgBWFlkDOKL0A/5/0tpw8Sly8U=; h=Date:To:From:Subject:From; b=mUb3b5cWUQVN4KhlkbUcY2mfRmqwJPU7iO5UXwQyC0gfczcXHmoVviSn4VD7p1J6M a+TZGQN5P1O/6rsqa8wBZyLT8MU4/+eS22+tTUi3Ml2xzgjqGVXsm/2ut1vu+YpeZg q9/PLBZV/tK4Ae6DsZGD4YCRMrGHeLx7bDYx2B+bbS+B1vePY9576GyzrehDPkc7dG PmqJqMG6AbWhup9MISbWsNbtHyipLS1zNOpPpImcKaoq2vkQocy1sUvdm8uRU4C5VG KBKICbGjVziqr6VfD0+HO5iFH3lwkfmUADUg00v9LrQqA/1EMzZ12YWp9lbEOMLG/G Sf3EQDx5C3OqQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 80479180054 for ; Tue, 29 Jul 2025 18:10:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from filter102.mijn.host (filter102.mijn.host [109.163.225.52]) (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 ; Tue, 29 Jul 2025 18:10:06 +0000 (UTC) Received: from h26.mijn.host ([2a03:5180:7:2:f264:726d:beae:1]) by filter102.mijn.host with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ugonf-00G9Hd-Ud for internals@lists.php.net; Tue, 29 Jul 2025 14:11:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=jnvsor.net; s=x; h=Content-Transfer-Encoding:Content-Type:Subject:From:To:MIME-Version: Date:Message-ID:Sender:Reply-To:Cc:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=9RAlgSwAfVQU7xzJhqbpul522WrxZUff1C8+YXih72k=; b=G Fa5wVwrvpS2HttJ2At9YBNZ8pJRZtnCwPXnLcc6mvqNCWLNlt5r2WxbFVzHCv4k99/9Bq+P8nfkrP jseF4TCktADOEJa0Qm+Ll8ujCe9M5hDcK2oIov/64xACR5p05DhOm8wK/EYv5m6Tv/zuhLybZtgrQ q7CDa4xc0pwY2mWY8rX4rZi9tM9sysRJnFNvceGPqJiXVgeLK4lQCEygEy4BnKeO/Li5yC6bT3AQq 3QxZX2lpLq8VxvcIakOSIEW6xp/RUX/dWy5+sApJCgJd6qEd+z/Kucq94DZKE66z3qdbkKVMPBafV 1LXvGCVPRDkhN2rNZ9r4+yrDHhWoMVTGg==; Received: from 2001-1c00-2a02-0700-d9d5-ec47-bd9a-e195.cable.dynamic.v6.ziggo.nl ([2001:1c00:2a02:700:d9d5:ec47:bd9a:e195]) by h26.mijn.host with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1ugonf-0000000AKIH-3nNw for internals@lists.php.net; Tue, 29 Jul 2025 20:11:43 +0200 Message-ID: Date: Tue, 29 Jul 2025 20:11:43 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: internals@lists.php.net Subject: [PHP-DEV] Protected inheritance hierarchies Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AuthUser: jnv@jnvsor.net X-Authenticated-Id: jnv@jnvsor.net X-Originating-IP: 2a03:5180:7:2:f264:726d:beae:1 X-mijn.host-Spamfilter-Domain: mijn.host X-mijn.host-Spamfilter-Username: 2a03:5180:7:2:f264:726d:beae:1/112 Authentication-Results: mijn.host; auth=pass smtp.auth=2a03:5180:7:2:f264:726d:beae:1/112@mijn.host X-mijn.host-Spamfilter-Outgoing-Class: unsure X-mijn.host-Spamfilter-Outgoing-Evidence: Combined (0.50) X-Recommended-Action: accept X-Filter-ID: 9kzQTOBWQUFZTohSKvQbgI7ZDo5ubYELi59AwcWUnuUzTJWl44fohdO16XxnGNOJexGm/SvLpnUa vEup2XDOqCu2SmbhJN1U9FKs8X3+Nt2sdENNz0Ob5Mcg8HV4NYhqYDYiFl9huZCsZDn+LUJsUzP0 QdkqZB6iu+CD6oEw4NEEybI1sOftHmSKUCHCvcq0VvcCA1Qa9BGdQX4vJy9/H5JVRKyFCRrxWkR6 oZhlSr1cMVvWhW/+k07JwV//rlf3iFKfD1jKgYfH+6S5qDVYoOmeRt7qHd5fQGuXWoplKlc1R6Pa oqS3DNVMIxswrKXj/bkKCxxzY2p31rOYNrhltnzprFRbpFQTOcEGeQOY3IecFR5Yg+xLJYwKSmVR caS8DlT23jFwJQ6bi2K/vxG0KiS3/0aXiE97ptqEFHGJYQ+ePfYw3UQ7nJrbBLDZSC0ytw6G02mD 56KU5N87rMzzQ7J7WH0CrN8od5iC+9lbnYxZ7b+MGaj/PAhfCVdIUv+n31/E3ahF5MMcDI7KdpjQ KTGolAHFX2yRkMh5bYRUFazYjDH+G0kDmDMsD3mmoLWlPZla/rT07rpnmNGb4JCTlRmZu2cicrxa qiqFMmVRKBqtI4g+l6rCWbY0MZcgnbHssPmIWbvlt0j/HTeJtA/MM9R+sXSfwQYIZCPMe1tFP1j5 fiorwKsEiSfwJ/4Ofm4yVNkCTuqia6yXKv72TrNrzhOD2lnK+Gj1NILbk8K1t4JU8BNeVc59Gnz5 4HdiDwdd0iyuI2/0FGpXLtiMsApY/NZcx1WE4dmNhYvFEzid1TRiz2KrlxFbshev8fZHEoAKERWe KKG4PAQYNyavp7c49C4od+2UnnEoe67Ur5b8AGQOg3+KKE4orq+HIjrJlb+wlxb1gQEkC05UbVxk q9AX/4jKFojrvUjjKLsywQkk4epFufiSEO0kX4EWsLQt4F9LZQ3W/hKHV3eTrro6IT8uA8gPyiUm KhXR7tc+p12lC/AlCkSujm58a/xB+XC1kCc6Nk02HBbuEgIBsry+WRySKt40eTXlWiUAYdLmsJdA oPIV4U9dEEkpMT0JEU7WaqdTlh5BrxVREcTzf8/gaNTwJDUmEd/Dw3bSBb7ao08FyxsZHnyEwCWd lQd5X2Hzj3/O X-Report-Abuse-To: spam@filter101.mijn.host X-Complaints-To: abuse@filter101.mijn.host From: jnv@jnvsor.net (Jonathan Vollebregt) I came across this edge case today: https://3v4l.org/R3Q8D Both psalm and phpstan think this code is A-OK (Once you add the requisite type hints) but it causes fatal errors way back to PHP 5.0.0 I believe classes should be able to access protected properties on their siblings if the property in question was declared by a shared parent, but it seems both the engine and reflection (ie. getDeclaringClass) think that redeclaring a protected property makes it a property of the child, not the parent. This is particularly confusing since the parent class *can* access the child class' redeclared protected property, only the sibling can't. Properties were invariant until the introduction of property hooks, so the only edge cases I can think of would be in property hooks (But when the input is correctly typed this shouldn't be a problem either) Is there a technical reason for this behavior or would it be possible to relax this? - Jonathan