0

I'm getting a semi-persistent error that seems to be related to coldcache.

Originally on PHP 7.2.6, though also present on PHP 7.3.5.

I'm experimenting with different caching approaches and my current favourite is wrapping the entire layout file with coldcache and then have a custom plugin clearing and warming the cache overnight.

Should also note that it is set as

{% coldcache unless currentUser %}

This is 99% working lovely, using nocache to ignore any dynamic content.

However, seemingly randomly I get this error:

count(): Parameter must be an array or an object that implements Countable

One way to cause the error without fail is to attempt to use the live preview. I've stripped a single back to having no fields and loading this template:

{% coldcache unless currentUser %}
<!--[if lte IE 9]><html class="no-js cmm old-ie" lang="en-gb" xml:lang="en-gb"><![endif]-->
<!--[if gt IE 9]><!--><html class="no-js" lang="en-gb" xml:lang="en-gb"><!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <h1>{{ entry.title }}</h1>
    </body>
</html>
{% endcoldcache %}

A normal {% cache %} tag works fine, but {% coldcache %} won't. Weirdly, in testing to write this script, that page now has the error even when loading directly, but some non stripped back pages still load fine.

Any ideas?

Updates

I've moved the </html> tag after {% endcoldcache %} and it seems to work - still testing. I have absolutely no idea why that should make a difference, but it certainly seems to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.