Throw an exception if we receive a document instead of a feed's root element

This commit is contained in:
Zach Copley 2010-03-15 19:06:06 -07:00
parent d1ea448c27
commit b994d529f4

View File

@ -1083,15 +1083,11 @@ class Activity
$this->entry = $entry; $this->entry = $entry;
// @fixme Don't send in a DOMDocument // Insist on a feed's root DOMElement; don't allow a DOMDocument
if ($feed instanceof DOMDocument) { if ($feed instanceof DOMDocument) {
common_log( throw new ClientException(
LOG_WARNING, _("Expecting a root feed element but got a whole XML document.")
'Activity::__construct() - '
. 'DOMDocument passed in for feed by mistake. '
. "Expecting a 'feed' DOMElement."
); );
$feed = $feed->getElementsByTagName('feed')->item(0);
} }
$this->feed = $feed; $this->feed = $feed;