Sharing group shares stable7

backport of https://github.com/owncloud/core/pull/10107. I just want to give Jenkins the chance to test it before we merge it to stable7.
in addition it's a valid question is a new exception has to be introduced - from my understanding this is a http://php.net/manual/en/class.unexpectedvalueexception.php