Skip to content

Commit 1a7ff01

Browse files
committed
Merge pull request #6 from geggleto/geggleto-patch-1
Stop Leaking
2 parents c6efdc2 + 5e8b369 commit 1a7ff01

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/PHPRenderer.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ public function render(ResponseInterface $response, $template, array $data = [])
5858
throw new \RuntimeException("View cannot render `$template` because the template does not exist");
5959
}
6060

61-
extract($data);
61+
$render = function ($template, $data) {
62+
extract($data);
63+
include $template;
64+
}
6265

6366
ob_start();
64-
include $this->templatePath . $template;
65-
$output = ob_get_clean();
67+
$render($this->templatePath . $template, $data);
68+
$output = ob_get_clean();
6669

6770
return $response->getBody()->write($output);
6871
}

0 commit comments

Comments
 (0)