oa_messages_create() is defined as follows:

oa_messages_create($message_type, $entity = NULL, $entity_type = 'node', $text = '', $args = NULL, $uid = NULL, $send = TRUE)

When oa_messages_create() is called with $entity = NULL and $entity_type = 'node', the code will fail at the following lines:

if (!empty($entity_type)) {
      // Since this can be called on node_update / insert, we clear the entity
      // cache so that it gets the values assigned by other modules.
      entity_get_controller($entity_type)->resetCache(array($entity_wrapper->getIdentifier()));
    }

At this point, $entity_wrapper is NULL but because of $entity_type = 'node' the if() is entered anyway.

Comments

Jorrit created an issue. See original summary.

jorrit’s picture

Status: Active » Needs review
StatusFileSize
new1.35 KB
mpotter’s picture

Status: Needs review » Needs work

Looks like some other changes got mixed into this patch. Not sure why you removed the user_load($uid) argument from the call to message_create(). That is needed when messages are created from a different user ($uid argument passed to oa_messages_create).

jorrit’s picture

StatusFileSize
new916 bytes

You're right, I forgot to undo changes for another issue.

jorrit’s picture

Status: Needs work » Needs review
jorrit’s picture

StatusFileSize
new837 bytes

Fixed the patch.

mpotter’s picture

Status: Needs review » Fixed

Fixed in oa_core d96395e.

Status: Fixed » Closed (fixed)

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