You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assignee: (none)
Status: Resolved (closed on 2016-02-27 21:50:06 +00:00)
Target Version: 2.2.0
Last Update: 2016-02-27 21:50:06 +00:00 (in Redmine)
This basically affects all pages doing $this->render(...) in their controller. This results in getNoRenderer being true in ZF viewRenderer, so this condition fails:
if (!$this->_helper->viewRenderer->getNoRender()) {
$layout->benchmark = $this->renderBenchmark();
Please be careful, fixing this should not affect non-HTML renderers or similar.
Disable benchmark only if the layout is disabled
Benchmark should be disabled if the response is not HTML. This is most likely the case when the layout is disabled.
If Web 2 or Zend sends JSON for example, the layout is disabled.
The follwing code inside an action disables the layout (and view):
$this->_helper->layout()->disableLayout();
The following code inside an action disables the action's view script:
$this->_helper->viewRenderer->setNoRender(true);
Note that an action's view script is also disabled via setNoRender() when rendering another view script via
render() or renderScript().
Another appraoch is to check the content-type. If explicitly set to not HTML, disable benchmark:
$renderBenchmark = true;
$response = $this->getResponse();
$headers = $response->getHeaders();
foreach ($headers as $header) {
if (strtolower($header['name']) === 'content-type'
&& stristr($header['value'], 'text/html') === false
) {
$renderBenchmark = false;
break;
}
}
if ($renderBenchmark) {
$layout->benchmark = $this->renderBenchmark();
}
Maybe we should also provide a action method for disabling benchmark, regardless of the user's setting.
refs #10856
This issue has been migrated from Redmine: https://dev.icinga.com/issues/10856
Created by tgelf on 2015-12-15 15:26:23 +00:00
Assignee: (none)
Status: Resolved (closed on 2016-02-27 21:50:06 +00:00)
Target Version: 2.2.0
Last Update: 2016-02-27 21:50:06 +00:00 (in Redmine)
This basically affects all pages doing $this->render(...) in their controller. This results in getNoRenderer being true in ZF viewRenderer, so this condition fails:
Please be careful, fixing this should not affect non-HTML renderers or similar.
Cheers,
Thomas
Changesets
2016-02-27 19:14:02 +00:00 by elippmann 7cef06f
2016-02-27 21:49:44 +00:00 by elippmann 9c5dfc5
The text was updated successfully, but these errors were encountered: