Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128368 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 43B131A00BC for ; Sat, 2 Aug 2025 12:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1754139255; bh=DpknFBFuZcZDb8FYxh0NLQbL/qAHCVA6co1b0gWbwfE=; h=Date:Subject:To:References:Cc:From:In-Reply-To:From; b=WT6FL7z/Vt3+RPNiI2jR0mR1RZu7lBMQy2sA0DwGH8ySWYaWVyH/fTYw10FppCHD0 Qwz7qah1ev+GXs64pAkcKPBLCyUGGrvPJ4ExtZaTaMtWE0WFwZttvGIYVep2hLjvak nPAy3rGEF8lHvogsbL/h+8FtuQCnIVnFVNQUjrfbLJ/tyPHaroWTQc1NUATcP5avOo J5l2hfdlVK5yUhowjErIE/Pieu/YUrXn22KZwa2EWyEhD5/RHl7xh5WbsUq0DERqPK asuNiiw1X1Z6vWTpbDyejJ2k8q48DLQTRPx6rJNXaKI91zRvx0roA55mCot5NDw07E lyh7gh63EDzTQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 08D00180039 for ; Sat, 2 Aug 2025 12:54:14 +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.2 required=5.0 tests=BAYES_20,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 [5.254.117.163]) (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 ; Sat, 2 Aug 2025 12:54:13 +0000 (UTC) Received: from h26.mijn.host ([2a03:5180:7:2:f264:726d:beae:1]) by filter102.mijn.host with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uiBmA-002p8H-S2; Sat, 02 Aug 2025 08:55:52 -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:In-Reply-To:From:Cc:References: To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=j15LZaJReSlz3LQI4AFKiDnWxrVZGLaLHKkNjme6/rk=; b=fW7kRmJqYjZqjp/ydLsqHnGGZy bgh56FBzQUpST+YeHdUdyui8r29ZAn2MW57HouLShCKMlni4Mz2ikSgDk9qSayAKRNI4VtxxB7naF NSc8nJWKniIMxCb6eAlIk1aAla9oX+3fkCwm901uYaIcxcHJ9vORVAJYUb4HxGlT+IPSW4wUnIafO pb388nASSL0eRqxmCK514ei3Gv3IjJ4FJXwc3gfKKf8QdiUW7Lun8uEX8+02Pq0Foyzh8WT9z1TVr s4dJGxOvxT4h34pXpTmtxc1Fy/6J+43sh7kChyiMadjWwjjJuauThiEa67wGcETe9lqwS/8Q2hNZ1 Ui5qTs9g==; Received: from 2001-1c00-2a02-0700-a062-4722-09fc-aefd.cable.dynamic.v6.ziggo.nl ([2001:1c00:2a02:700:a062:4722:9fc:aefd]) by h26.mijn.host with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1uiBmA-0000000CwXz-2xIT; Sat, 02 Aug 2025 14:55:50 +0200 Message-ID: <9604c641-fb1d-4c5f-a029-3bfa027bf086@jnvsor.net> Date: Sat, 2 Aug 2025 14:55:50 +0200 Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Protected inheritance hierarchies To: Rob Landers References: <2d516e15-2fc7-4ac4-b9c2-7146ac01cfb1@app.fastmail.com> Content-Language: en-US Cc: internals@lists.php.net In-Reply-To: <2d516e15-2fc7-4ac4-b9c2-7146ac01cfb1@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: ham X-mijn.host-Spamfilter-Outgoing-Evidence: Combined (0.26) X-Recommended-Action: accept X-Filter-ID: 9kzQTOBWQUFZTohSKvQbgI7ZDo5ubYELi59AwcWUnuU/EnE6BIVFkIwEFbebTM9UNaTy/6BmdQaW 6D8wiBL9Riu2SmbhJN1U9FKs8X3+Nt2sdENNz0Ob5Mcg8HV4NYhqYDYiFl9huZCsZDn+LUJsU4+Q 4/R2gS5Unx8PNyHFps0EybI1sOftHmSKUCHCvcq0VvcCA1Qa9BGdQX4vJy9/H5JVRKyFCRrxWkR6 oZhlSr2IwdrR6MCRf9fSYHlHvEpziFKfD1jKgYfH+6S5qDVYoOmeRt7qHd5fQGuXWoplKlc1R6Pa oqS3DNVMIxswrKXjmTmYf9felIf8Q0lvYJANy1im26jqdSLearSSTVIJyNKROUzReCS8EpKh0It9 L25JS816nuiE0t5pG6MLXGczodD6n5G6jw4mRNxot7VM8k9eU13R5GRisKd7Cpd4JJuGILIejoSc poot5WKwlo2dbdgFRynr5duqaiP+JtZKoQPGLwTIQNNPqNOPF/so6xWnbVcVWzkLtkIUbefa3NbH Kpc59lzUzvTEK+Uqw6PE/u7KuzDY+5x77+RY9BSYyht4On02JTRNJesPXaFd0pgPtOq9wtkIM3Ps UTmXxp6BN+taHHderbgAXsu5dIYoVN3LtixBzAFls8HrYidi62+42jPwg3Ran/r0gMtgqwZZbpTE LeatZA96RrhoSqJpzM+w1jRaBZLP6jsasJSTg7dcGX6AFEQGoYATRxMWebz+WNWUrbeUFahCzauL TLcsDy1G0tyfRa+7DFCbefWZabhQvvTMJKNSKuIt29tfB+vdNqtuQlK+ymUmkYRGmTQkTzoTMxAf otCGzDZkl4QlI5v1Yx2lpgkVq+xP9tumT5Y5PbjMdMnLl3/hVAgywsv1hKtMPLbkDqY2eXk4bkT8 PiChGQnpQfvRxRX1Uq53kUvEQoneq+vfQZNqPqAVT3YaTxZcUV8ShebT8U8Xw9HTDfreWUB3Q2fy s6PCXt4asqvGFMrBqnrW+DYb+TAXVZsivwKCr3vxjsH0GFZEcJqbKICEJtWxSVd/lsDmmMOY1jgp WTtKcIOSajb4SwOJeYoaS0vLgeY3tKetbIaB909lctYg6sddcUgxA7YvlbL81yrRuBH10tfqoGlb dTkTLaWCAXLaltNBJJmzUi3BRF4p6e8zRQ== X-Report-Abuse-To: spam@filter101.mijn.host X-Complaints-To: abuse@filter101.mijn.host From: jnv@jnvsor.net (Jonathan Vollebregt) On 8/2/25 11:07 AM, Rob Landers wrote: > It's not an edge case, in C2, you redefine a protected variable with the > same name and shadowed the original $v. That $v is different than C's > $v. It's easiest to see this with static access: > https://3v4l.org/0SRWb#v8.4.10 > > However, I don't know of any way to unshadow a property from $this to > access the ancestor's value (other than using private access), but it > exists and takes up memory; just accessing it is the hard part. > > — Rob Ah I see, thanks. Both getProperties and array casting clobber the shadowed protected properties (Unlike private properties) but you can access the property with reflection by reflecting the parent class. Could it be considered a bug that my first example produces a fatal error instead of trying to access the shadowed parent property that it has access to and is typed to use? I guess that would introduce either too much of a performance penalty recursively checking access for each protected property read, or too much complexity trying to pin down the variable type at parse time. Thanks for the info!