In #1098758-10: Notice: Trying to get property of non-object in ctools_node_comment_form_content_type_render() this fix was added:

 // If we had requested a $context but that $context doesn't exist
    // in our context list, there is a good chance that what happened
    // is our context IDs changed. See if there's another context
    // that satisfies our requirements.
    if (!$this->skip_name_check && !empty($context) && !isset($contexts[$context])) {
      $choices = $this->filter($contexts);

      // If we got a hit, take the first one that matches.
      if ($choices) {
        $keys = array_keys($choices);
        $context = reset($keys);
      }
    }

The problem with this is that it can choose the wrong context if the ID _hasn't_ changed. This is the scenario:

- There are two user contexts (in my case, they were coming from user reference fields on the node but I don't think that matters).
- There are user field content panes that are tied to one of the contexts.
- That context does not exist, intentionally. (In my case, the field was not filled in)
- Instead of not rendering the pane because the context doesn't exist, it looks to see if there is another one that would work and chooses the other user context. Since this is a different user, the wrong information is printing.

I'm not sure how to fix this as it essentially requires ctools to be psychic and know that the ID didn't change to the other one but rather the one it's looking for is intentionally missing. I don't know if it's possible at this point in the code to look and see that the wanted context is still defined on the page even if it's not available. If it is, that may be the way to fix it.

Comments

Michelle created an issue.

Michelle’s picture

I realized there is a work around for this. Set a visibility rule on context exists. If the context it is supposed to be using doesn't exist, then nothing will display. Still would be nice to fix this in the module but there's at least a non-hacking way around it.

MustangGB’s picture

Just ran into the same problem and spent a while searching for it in the panels issue queue.

Using Michelle's workaround for now.