Fix error handling for missing group in apigroupmembership -- was trying to call methods on the variable before we checked it, which triggers PHP fatal error
This commit is contained in:
parent
cb56f445b8
commit
74a1c9def0
@ -66,6 +66,12 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
|||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
$this->group = $this->getTargetGroup($this->arg('id'));
|
$this->group = $this->getTargetGroup($this->arg('id'));
|
||||||
|
if (empty($this->group)) {
|
||||||
|
// TRANS: Client error displayed trying to show group membership on a non-existing group.
|
||||||
|
$this->clientError(_('Group not found.'), 404, $this->format);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->profiles = $this->getProfiles();
|
$this->profiles = $this->getProfiles();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -84,12 +90,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
|||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (empty($this->group)) {
|
|
||||||
// TRANS: Client error displayed trying to show group membership on a non-existing group.
|
|
||||||
$this->clientError(_('Group not found.'), 404, $this->format);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// XXX: RSS and Atom
|
// XXX: RSS and Atom
|
||||||
|
|
||||||
switch($this->format) {
|
switch($this->format) {
|
||||||
|
Loading…
Reference in New Issue
Block a user