Similar to #2443037: Improper assumptions in hook_ctools_render_alter():

For response handlers $info['content'] is not set at all. This can be seen in page_manager_http_response_render().

Not sure if we want to early return in that case or expand the if-else.

Comments

tstoeckler created an issue. See original summary.

nkanderson’s picture

I'm getting this notice due to a redirect on a specific content type. Are there potential issues with checking if $info['content'] is set, like in the snippet below?

    if (isset($info['content'])) {
      if (is_array($info['content'])) {
        $info['content']['#prefix'] = $prefix;
        $info['content']['#suffix'] = $suffix;
      }
      else {
        $info['content'] = $prefix . $info['content'] . $suffix;
      }
    }
tstoeckler’s picture

Yes, I think such a check is correct. We should also add a comment noting in that HTTP response handlers do not set the content key.

I also think we should put the check outside of the foreach loop. So I would propose changing

  if ($context['task']['task type'] == 'page') {

to something like:

  // Ignore task handlers that do not set any content, such as HTTP responses.
  if (($context['task']['task type'] == 'page') && isset($info['content'])) {

@nkanderson: Could you roll a patch that would be awesome?

nkanderson’s picture

StatusFileSize
new635 bytes
nkanderson’s picture

Status: Active » Needs review
nkanderson’s picture

@tstoeckler Is there more I need to do to keep the review process going? This is my first patch submission...

devin carlson’s picture

Status: Needs review » Fixed

Thanks for the patch! Tested #4 and committed to Quick Edit 7.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.