Re: is_literal() compile-time awkwardness
On Mon, Jun 28, 2021 at 7:21 PM Craig Francis <craig@craigfrancis.co.uk> wrote:
> There’s an awkward hitch with removing integer support.
Correct me if I'm wrong, but all those inconsistencies would happen
even if all integers were considered literal, e.g.
https://3v4l.org/C9YpE/vld#output clearly performed
compile-time
concatenation with a float.
> Now these aren’t security issues, and it doesn’t work the other way round:
> is_literal() doesn't incorrectly report any user (non-literal) data as a
> literal.
I'd say it's fine that way.
> OPcache adds its own similar twist if it’s enabled, but with the added fun
> that unlike PHP’s own optimisation processes, OPcache is by its nature
> inconsistent when it runs, changing what it optimises and when based on a
> number of factors (e.g. available memory) and so isn’t guaranteed to
> optimise the code every time.
Now that's a problem. If the same code produces different results for
expression literalness depending on external factors like available
memory it may pass in the test environment, but fail in production.
--
Best regards,
Bruce Weirdan mailto:weirdan@gmail.com
Thread (2 messages)