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!

  • 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 Jun 7 '17 at 22:56
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'))
        );
    }
    //...
}
| improve this answer | |

Your Answer

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

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