Skip to content

Commit

Permalink
Merge pull request #6 from geggleto/geggleto-patch-1
Browse files Browse the repository at this point in the history
Stop Leaking
  • Loading branch information
akrabat committed Nov 2, 2015
2 parents c6efdc2 + 5e8b369 commit 1a7ff01
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/PHPRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ public function render(ResponseInterface $response, $template, array $data = [])
throw new \RuntimeException("View cannot render `$template` because the template does not exist");
}

extract($data);
$render = function ($template, $data) {
extract($data);
include $template;
}

ob_start();
include $this->templatePath . $template;
$output = ob_get_clean();
$render($this->templatePath . $template, $data);
$output = ob_get_clean();

return $response->getBody()->write($output);
}
Expand Down

0 comments on commit 1a7ff01

Please sign in to comment.