TypeError after update to Latte 2.9

Tritol
Member | 3
+
0
-

When I try to update to 2.9 I get this error message:

Fatal error: Uncaught TypeError: Argument 2 passed to Latte\Runtime\FilterExecutor::add() must be callable, array given, called in /vendor/latte/latte/src/Latte/Engine.php on line 80

Everything works fine with 2.8.3

Do I have to make any other changes to get 2.9 to work? I couldn't find anything.

David Matějka
Moderator | 6445
+
0
-

Hi, it is a custom filter you are trying to add? Have you checked that it is really a valid callback – that the class exists, method exists and the method is public? could you please provide complete tracy backtrace?

Tritol
Member | 3
+
0
-

Hi and thanks for the help.

I just try to initiate Latte with:
$this->latte = new \Latte\Engine;
$this->latte->setTempDirectory(‘../temp/latte’);

Backtrace:

…/vendor/latte/latte/src/Latte/Engine.php:80 Latte\Runtime\FilterExecutor->add()

70:        private $sandboxed = false;
71:
72:
73:        public function __construct()
74:        {
75:            $this->filters = new Runtime\FilterExecutor;
76:            $this->functions = new \stdClass;
77:
78:            $defaults = new Runtime\Defaults;
79:            foreach ($defaults->getFilters() as $name => $callback) {
80:                $this->filters->add($name, $callback);
81:            }
82:            foreach ($defaults->getFunctions() as $name => $callback) {
83:                $this->functions->$name = $callback;
84:            }

$name “webalize” (8)
$callback array
0 ⇒ “Nette\Utils\Strings”
1 ⇒ “webalize”

/www/htdocs/library/View.php:12 Latte\Engine->__construct()

…/htdocs/library/Controller.php:9 \library\View->__construct()

…/controllers/LoginController.php:20 \library\Controller->__construct()

…/htdocs/library/Bootstrap.php:55 \controllers\LoginController->__construct()

…/htdocs/library/Bootstrap.php:16 \library\Bootstrap->_loadExistingController()

/www/htdocs/public/index.php:43 \library\Bootstrap->init()

David Matějka
Moderator | 6445
+
+1
-

I see… it is a bug. I've reported it here: https://github.com/…e/issues/238

the fastest workaround is to require nette/utils dependecy

Tritol
Member | 3
+
0
-

Yep, installing nette/utils solved it.
Thanks again for the help!