Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for Renderer::_render() with no set $request property. #624

Closed
wants to merge 1 commit into from

3 participants

Mike Greiling Don't Add Me To Your Organization a.k.a The Travis Bot Nate Abele
Mike Greiling

Quick fix in the renderer class for instances when $_request is null. I encountered this when attaching my own error handler method which was not attached to Dispatch::run() as the example error handler is, and thus the request object was not available.

My error template called $this->_render() to include a template element and this raised an ErrorException "Trying to get property of non-object in [...]/Projects/Lithium/dev/li3_core/libraries/lithium/template/view/Renderer.php on line 490";

Don't Add Me To Your Organization a.k.a The Travis Bot

This pull request passes (merged 6387beb into c3419a4).

Nate Abele
Owner

Looks good. Once we get a test case and this is submitted against the dev branch, we'll get it merged in.

Nate Abele
Owner

Merged to dev in 51d1770

Nate Abele nateabele closed this
Mike Greiling

sorry, got a little busy. I see this had been merged now, do you still need a test case for this?

Nate Abele
Owner

No, it's fine. @mehlah is actually rewriting the affected code not to rely on $_request.

Mehdi Lahmam mehlah referenced this pull request
Closed

Renderer options #642

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 2 deletions.
  1. +4 −2 template/view/Renderer.php
6 template/view/Renderer.php
View
@@ -486,8 +486,10 @@ public function set(array $data = array()) {
* @return string Returns a the rendered template content as a string.
*/
protected function _render($type, $template, array $data = array(), array $options = array()) {
- $library = $this->_request->library;
- $options += compact('library');
+ if ($this->_request) {
+ $library = $this->_request->library;
+ $options += compact('library');
+ }
return $this->_view->render($type, $data + $this->_data, compact('template') + $options);
}
}
Something went wrong with that request. Please try again.