Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ #10856] Benchmark is not rendered on many pages #2204

icinga-migration opened this issue Dec 15, 2015 · 2 comments


Copy link

@icinga-migration icinga-migration commented Dec 15, 2015

This issue has been migrated from Redmine:

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:

if (!$this->_helper->viewRenderer->getNoRender()) {
    $layout->benchmark = $this->renderBenchmark();

Please be careful, fixing this should not affect non-HTML renderers or similar.



2016-02-27 19:14:02 +00:00 by elippmann 7cef06f

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):

The following code inside an action disables the action's view script:

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;
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

2016-02-27 21:49:44 +00:00 by elippmann 9c5dfc5

Merge branch 'bugfix/benchmark-not-always-rendered-10856'

fixes #10856

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Jan 5, 2016

Updated by elippmann on 2016-01-05 10:30:10 +00:00

  • Category set to Framework
  • Target Version set to 2.2.0

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Feb 27, 2016

Updated by elippmann on 2016-02-27 21:50:06 +00:00

  • Status changed from New to Resolved
  • Done % changed from 0 to 100

Applied in changeset 9c5dfc5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.