mirror of https://github.com/MISP/MISP
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 keyspull/9044/head
parent
50c7b930f6
commit
2ea3bde1a2
|
@ -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.'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue