Skip to content

Commit

Permalink
issue: No Ticket For checkStaffPerm()
Browse files Browse the repository at this point in the history
This addresses an issue where there may be no `$ticket` available which
makes the `checkStaffPerm()` check fatally fail. This adds a check for
`$ticket` before checking the permissions. If no Ticket exists then we
set `Access Denied` error.
  • Loading branch information
JediKev committed Nov 3, 2022
1 parent c2a15b6 commit 5e97006
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scp/tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
$errors['err']=sprintf(__('%s: Unknown or invalid ID.'), __('ticket'));
elseif($_REQUEST['number'] && !($ticket=Ticket::lookup(array('number' => $_REQUEST['number']))))
$errors['err']=sprintf(__('%s: Unknown or invalid number.'), __('ticket'));
elseif(!$ticket->checkStaffPerm($thisstaff)) {
elseif(!$ticket || !$ticket->checkStaffPerm($thisstaff)) {
$errors['err']=__('Access denied. Contact admin if you believe this is in error');
$ticket=null; //Clear ticket obj.
}
Expand Down

0 comments on commit 5e97006

Please sign in to comment.