> Am 25.05.2016 um 23:56 schrieb Stanislav Malyshev <[email protected]>:
>
> Hi!
>
>> var_dump($a->w); // Fatal error, uninitialized...
>
> This means every read access to a property should be checked for it
> being typed, and every access to a typed property should be checked for
> it being initialized. I'm concerned there might be a performance hit for
> this.
>
> Also, this means no access for a property - even defined one - is safe,
> and if you want to avoid fatal errors, you need to check every access,
> at least if you suspect typed properties may be involved. And, of
> course, there's no function in the RFC to actually check it.
> --
> Stas Malyshev
> [email protected]
Hey Stas,
this is pretty much a non-issue (perf-wise) as we anyway need to check against
IS_UNDEF to emit a notice and return null, even with normal properties.
Also, property access never was safe. Consider:
$obj = new class {
public $foo;
function __construct() {
unset($this->foo);
}
function __get($prop) {
throw new Exception("No $prop for you today!");
}
};
var_dump($obj->foo); // exception.
isset() checks will continue to work. It's just about getting a *value*. (and
to check whether it's a typed property, there's Reflection support in the RFC.)
This definitely is no problem.
Bob
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php