On 23 November 2023 01:37:06 GMT, Claude Pache <claude.pa...@gmail.com> wrote:
>What you describe in the last sentence is what was initially designed and 
>implemented by the RFC: https://wiki.php.net/rfc/typed_properties_v2 (section 
>Overloaded Properties).
>
>However, it was later changed to the current semantics (unset() needed in 
>order to trigger __get()) in https://github.com/php/php-src/pull/4974


Good find. So not only is it not specified this way in the RFC, it actually 
made it into a live release, then someone complained and we rushed out a more 
complicated version "to avoid WTF". That's really unfortunate.

I'm not at all convinced by the argument in the linked bug report - whether you 
get an error or an unexpected call to __get, the solution is to assign a valid 
value to the property. And making the behaviour different after unset() just 
hides the user's problem, which is that they didn't expect to *ever* have a 
call to __get for that property.

But I guess I'm 4 years too late to make that case.

Regards,

-- 
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to