diff --git a/XMPPHP/XMPP.php b/XMPPHP/XMPP.php index c0f8963..808e6e8 100644 --- a/XMPPHP/XMPP.php +++ b/XMPPHP/XMPP.php @@ -229,10 +229,11 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream { } else { $payload['type'] = 'chat'; } + $body = $xml->sub('body'); $payload['from'] = $xml->attrs['from']; - $payload['body'] = $xml->sub('body')->data; + $payload['body'] = is_object($body) ? $body->data : FALSE; // $xml->sub('body')->data; $payload['xml'] = $xml; - $this->log->log("Message: {$xml->sub('body')->data}", XMPPHP_Log::LEVEL_DEBUG); + $this->log->log("Message: {$payload['body']}", XMPPHP_Log::LEVEL_DEBUG); $this->event('message', $payload); }