On 5/26/2016 1:57 PM, Rowan Collins wrote:
> I am definitely in favour of this from a language point of view. The
> notice is warning about *initialization*, not *declaration*, so it makes
> sense to warn on "var $foo" and not "var $foo = null".
> 
> The only thing I'm not sure is what the impact would have on the
> internals, which may be why it doesn't already work that way. With a
> simple variable the notice can be easily raised based on the variable
> name not being in the current symbol table; with an object property, the
> name *is* in the relevant table, because it's been *declared* even
> though it hasn't been *initialized*. Thus you need some extra flag to
> track that a declared property exists but has never been written to.
> 
> But it sounds like typed properties require adding some such overhead
> anyway...
> 
> Regards,

Looking at `zend_object_handlers.c` and `zend_std_read_property` there
is the line:

  retval = &EG(uninitialized_zval);

This is what gives us the default null of our properties if I interpret
everything correctly. This is also the place where the undefined
property error comes from.

We need help here from people who know the PHP source better.

-- 
Richard "Fleshgrinder" Fussenegger

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to