fix: [upload_stix] PHP is not python

- `array_key_exists` is the friend we were looking for here
- `in_array` only tests the values of an array and not the keys
pull/9044/head
Christian Studer 2023-04-21 16:36:54 +02:00
parent 50c7b930f6
commit 2ea3bde1a2
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 2 additions and 2 deletions

View File

@ -2389,7 +2389,7 @@ class EventsController extends AppController
}
if (isset($this->params['named']['distribution'])) {
$distribution = intval($this->params['named']['distribution']);
if (in_array($distribution, $distributionLevels)) {
if (array_key_exists($distribution, $distributionLevels)) {
$initialDistribution = $distribution;
} else {
throw new MethodNotAllowedException(__('Wrong distribution level'));
@ -2401,7 +2401,7 @@ class EventsController extends AppController
throw new MethodNotAllowedException(__('The sharing group id is needed when the distribution is set to 4 ("Sharing group").'));
}
$sharingGroupId = intval($this->params['named']['sharing_group_id']);
if (!in_array($sharingGroupId, $sgs)) {
if (!array_key_exists($sharingGroupId, $sgs)) {
throw new MethodNotAllowedException(__('Please select a valid sharing group id.'));
}
}