All add-ons currently require PHP 7.4 or greater.

On July 4th 2024 PHP 8.2 will be the new minimum requirement for all add-ons. Expect any add-on released after that date to require 8.2 or greater. Some releases may not immediately take advantage of 8.x specific features in PHP, which means you might, be able to continue using new releases in PHP 7.4, however, if you experience an error the first thing you should do is update to PHP 8.2 then create a support ticket if the error persists.

Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Static caching inside if conditions failing

Status Resolved
Add-on / Version Speedy 1.7.0
Severity
EE Version 6.4.4

Hop Studios

Apr 29, 2024

Hey there, can you please let me know where the static file caching happens? I’m trying to debug an issue where the speedy:static is caching the page when the if conditions are not met.

In the code, you can see that I’m trying to catch non-ascii characters in the URL because they make the “key” generation incorrect when parsed by speedy. However, the caching is still happening. By going to the wrong URL, say redemption-in-cancĂșn, it will display the content correctly but it will cache itself to the homepage because the current_url containing the non-ascii characters will result in an empty key.

{if !(current_url ~ "/\s/u")
    && current_url ~ "/^https\:\/\/[A-Za-z0-9\-_.~\/]+$/"
    && layout:skip_speedy != 'y'}
    {exp:speedy:static {if layout:speedy_tags}tags="{layout:speedy_tags}"{/if} url_prefix="{if publisher:current_language_id != publisher:default_language_id}{publisher:current_language_code}{/if}"}
{if:else}
    Not cached, which is good.
{/if}
  • Gil
#1

BoldMinded (Brian)

It happens in the mod.speedy.php file in the static function, line 191 or so. handleShutdown() is where the magic happens.

#2

Hop Studios

Ok I’ll do more investigation, but can you please check my logic to see why it’s still static caching the page even when the if is failing? I did move everything to a separate template to confirm that it is failing the conditions properly. I also removed the the exp:speedy:static tag to confirm that the page doesn’t get cached when the tag is not there.

– Gil

#3

Hop Studios

I think I found it…without the layout:skip_speedy != ‘y’ the if conditions are properly run. I think it has something to do with parse order.

– Gil

#4

BoldMinded (Brian)

Glad you figured it out. I’ll go ahead and close this since it seems to be an EE parse order issue more than anything.

Login to reply