You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "Seth Yastrov (JIRA)" <ji...@apache.org> on 2014/03/07 12:03:42 UTC

[jira] [Created] (CMIS-768) CMISService::getLink doesn't check that link exists in link cache, only that link cache exists

Seth Yastrov created CMIS-768:
---------------------------------

             Summary: CMISService::getLink doesn't check that link exists in link cache, only that link cache exists
                 Key: CMIS-768
                 URL: https://issues.apache.org/jira/browse/CMIS-768
             Project: Chemistry
          Issue Type: Bug
          Components: cmis-phplib
    Affects Versions: PHPCMIS 0.2
         Environment: PHP 5.3.10-1ubuntu3.10 with Suhosin-Patch
            Reporter: Seth Yastrov


I am using phpclient 0.2.0-RC1 installed in a Drupal 7 installation.
I receive the following PHP error when trying to synchronize CMIS nodes to Drupal:

"Notice: Undefined index: edit-media in CMISService->getLink() (line 263 of /var/www/jh/cmis/cmis_service.php)."

It appears that the code for getLink, at line 261 of cmis/cmis_service.php doesn't check that the key $linkName exists in the $this->_link_cache, before returning it:

{code}
	function getLink($objectId, $linkName) {
		if (array_key_exists($objectId, $this->_link_cache)) {
          return $this->_link_cache[$objectId][$linkName];
        }
		$obj = $this->getObject($objectId);
		return $obj->links[$linkName];
	}
{code}

The function should check if that key exists in the _link_cache and if not, call getObject() before returning the value.

So the code should look something like this:

{code}
	function getLink($objectId, $linkName) {
		if (array_key_exists($objectId, $this->_link_cache)) {
      if (isset($this->_link_cache[$objectId][$linkName])) {
          return $this->_link_cache[$objectId][$linkName];
        }
    }
		$obj = $this->getObject($objectId);
		return $obj->links[$linkName];
	}
{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)