Skip to content

Commit 0ebb9f1

Browse files
authored
Merge pull request #12 from paulredmond/patch-2
Fix fatal error with --format=html when using a closure
2 parents d442abc + 214f875 commit 0ebb9f1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/RequestContextProvider.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,21 @@ public function getContext(): ?array
2626
if (null === $this->currentRequest) {
2727
return null;
2828
}
29+
2930
$controller = null;
31+
3032
if ($route = $this->currentRequest->route()) {
3133
$controller = $route->controller;
34+
35+
if (! $controller && ! is_string($route->action['uses'])) {
36+
$controller = $route->action['uses'];
37+
}
3238
}
3339

3440
return array(
3541
'uri' => $this->currentRequest->getUri(),
3642
'method' => $this->currentRequest->getMethod(),
37-
'controller' => $controller ? $this->cloner->cloneVar(class_basename($this->currentRequest->route()->controller)) : $controller,
43+
'controller' => $controller ? $this->cloner->cloneVar(class_basename($controller)) : $controller,
3844
'identifier' => spl_object_hash($this->currentRequest),
3945
);
4046
}

0 commit comments

Comments
 (0)