Hi Tim

> > https://wiki.php.net/rfc/arbitrary_static_variable_initializers
> > https://externals.io/message/118976
>
> There is an unresolved "question":
>
> > Side note: It's been suggested that expressions that can be evaluated 
> > constantly continue to do so. This would mean that some expressions in 
> > getStaticVariables are evaluated and some are not. The upside is that this 
> > would avoid the backward incompatibility. I will check if this is 
> > technically feasible.

Ah, thanks for catching this. This has been partially implemented. PHP
will attempt to evaluate the constant expression at compile time. If
successful, the value will continue to be available from
ReflectionFunction::getStaticVariables() right away. Only when the
expression isn't known at compile time (including class constants from
other files) will it contain null until the function is called. This
reduces the BC incompatibility but doesn't completely avoid it.

Ilija

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

Reply via email to