Closed jmcgaha closed 5 years ago
hmmmm. I don't see how that could be? It's wrapped in a conditional:
{% set webpageTestApiKey = settings.webpageTestApiKey %}
{% if craft.webperf.craft31 %}
{% set webpageTestApiKey = parseEnv(webpageTestApiKey) %}
{% endif %}
craft31
comes from:
self::$craft31 = version_compare(Craft::$app->getVersion(), '3.1', '>=');
This doesn't make sense...?
Yeah I double checked just to make sure the site didn't get updated without me knowing. Craft 3.0.40.
So then I went and edited the backend.twig file starting on line 119.
{% if craft.webperf.craft31 %}
Craft 3.1
{# {% set webpageTestApiKey = parseEnv(webpageTestApiKey) %} #}
{% else %}
Not Craft 3.1
{% endif %}
The page now loads and outputs the text "Not Craft 3.1". If I unhide the parseEnv line the errors returns. Not sure why its evaluating to false but then still running the parseEnv stuff, but that's what appears to be happening.
Weird. Alright, I guess I'll have to pick a different way to do this. I'm assuming that Twig probably tries to tokenize the entire template, so if a particular function doesn't exist, it'll error when compiling the template, whether or not the code path is taken or not.
I have a site still on 3.0.39 and when I'm on an entry and click "Page Performance Details" I get a twig error:
I remember seeing parseEnv in recent craft release notes and it looks like maybe it was added in 3.1. I was able to check on our staging server which has 3.1 on it and it worked fine. So maybe required version needs bumped up or something.