When I run a local server my website is working fine with Slim. I did not change any vendor code.
But when I upload my project to a remote server and try to run it there, it throws the error below. I don’t understand, because I didn’t change any vendor code so it can’t be that there’s anything wrong with that. The error occurs with the following function in Twig.php. But both of the arguments have a default value of empty array.
public function fetch($template, $data = [])
{
$data = array_merge($this->defaultVariables, $data);
return $this->environment->render($template, $data);
}
Slim Application Error
The application could not run because of the following error:
Details
Type: TypeError
Message: Argument 2 passed to Twig\Environment::render() must be of the type array, null given, called in /vendor/slim/twig-view/src/Twig.php on line 92
File: /vendor/twig/twig/src/Environment.php
Line: 316