# Slim/Twig Application Error only on remote server

**URL:** <https://discourse.slimframework.com/t/slim-twig-application-error-only-on-remote-server/3150>\
**Category:** Questions\
**Created:** [May 5, 2019, 6:05pm UTC](https://discourse.slimframework.com/t/slim-twig-application-error-only-on-remote-server/3150 "2019-05-05T18:05:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Magicnerd](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@Magicnerd](https://discourse.slimframework.com/u/Magicnerd)\
**Post date:** [May 5, 2019, 6:05pm UTC](https://discourse.slimframework.com/t/slim-twig-application-error-only-on-remote-server/3150/1 "2019-05-05T18:05:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jDolba](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/jdolba/32/815_2.png) [@jDolba](https://discourse.slimframework.com/u/jDolba)\
**Post date:** [May 5, 2019, 8:35pm UTC](https://discourse.slimframework.com/t/slim-twig-application-error-only-on-remote-server/3150/2 "2019-05-05T20:35:39Z")

</div>

problem here is that you are passing NULL somewhere in your (probably) “controller” (anonymous function)

- Twig-\>render(Object(Slim\Http\Response), ‘index.html.twig’, NULL)

(passing null to array\_merge should produce at least PHP Warning, that means you have disabled php error reporting)

problem is in your controller and disabled error reporting (error might change value of variable to null)

---

<div class="post-metadata">

**Author:** ![Magicnerd](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@Magicnerd](https://discourse.slimframework.com/u/Magicnerd)\
**Post date:** [May 5, 2019, 9:44pm UTC](https://discourse.slimframework.com/t/slim-twig-application-error-only-on-remote-server/3150/3 "2019-05-05T21:44:41Z")

</div>

Yes I know NULL was passed somewhere, but the problem is I don’t know where or how. Because on my local php server, I use the exact same routing and controllers, but I don’t have any problem there.

Edit. Fixed through error reporting. It happened to be a JSON file that had a bad route that could not be found. Thanks!
