Hi Mark,

https://wiki.php.net/rfc/undefined_property_error_promotion
>

[note: the RFC Date has a +1 on the year]

I'm in favor for "fixed" classes (with all properties declared and no
`__get()` magic method),
but somewhat mixed for `stdClass`: as you said, it can come from a
`json_decode()` by default or an `(object)$array` cast, and is kind of
"interchangeable" with `array` (which can come from a `json_decode()` with
`associative: true` / `flags: JSON_OBJECT_AS_ARRAY` or an `(array)$object`
cast);
as such, I wonder if it wouldn't make more sense to rather handle undefined
properties *on stdClass* together with undefined *array keys*?
(the reasoning could even be extended to classes annotated with the
`#[AllowDynamicProperties]` attribute...)

Regards,

-- 
Guilliam Xavier

Reply via email to