Christoph Becker wrote on 09/06/2015 13:35:
Current behavior:
<?php
$v = NULL;
echo $v->foo->bar;
?>
Notice: Trying to get property of non-object in %s on line %d
Notice: Trying to get property of non-object in %s on line %d
So trying to access a property on NULL gives a notice, but trying to
access an element of NULL shouldn't? Also note, that chained property
access raises multiple notices.
Again, assignment works differently here:
$v = NULL;
$v->foo->bar = 42;
// Warning: Creating default object from empty value
Interestingly, only one Warning is issued for this case, even though the
inner value must also be created. This seems like a more useful
behaviour, because it doesn't clutter the log/output with repeated
notices about a single line.
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php