1

After updating from Craft CMS 2.6.2973 to Craft CMS 2.6.2981 I get the following error message: "Unable to load the "Craft\xyz" runtime after Craft update"

  • "Craft\xyz" is a Twig extension
  • Fails in [install folder]\craft\app\vendor\twig\twig\lib\Twig\Environment.php line 900 (Twig_Environment::getRuntime())
  • Twig_Environment::runtimes is an empty array

Anyone else experienced this problem, and know what is causing it?

Thanks in advance!

1
  • Is Craft\xyz a Twig extension coming from a plugin? Can you try downloading a fresh copy of Craft from craftcms.com and replace your existing craft/app folder with the fresh one? Would hurt to do the same for the plugin if there is one as well.
    – Brad Bell
    Commented Jun 7, 2017 at 22:56

1 Answer 1

2

Fixed by changing:

class xyz extends \Twig_Extension
{
    //...
    public function getFunctions()
    {
        return array(
            new \Twig_SimpleFunction('kex_cache_breaker', array(__CLASS__, 'cacheBreaker'))
        );
    }
    //...
}

To:

class xyz extends \Twig_Extension
{
    //...
    public function getFunctions()
    {
        return array(
            new \Twig_SimpleFunction('kex_cache_breaker', array($this, 'cacheBreaker'))
        );
    }
    //...
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.