diff --git a/src/lti/LTI_Message_Launch.php b/src/lti/LTI_Message_Launch.php index 7a18195d..9b9e3235 100644 --- a/src/lti/LTI_Message_Launch.php +++ b/src/lti/LTI_Message_Launch.php @@ -238,8 +238,8 @@ private function cache_launch_data() { private function validate_state() { // Check State for OIDC. - if ($this->cookie->get_cookie('lti1p3_' . $this->request['state']) !== $this->request['state']) { - // Error if state doesn't match + if (!isset($this->request['state']) || $this->cookie->get_cookie('lti1p3_' . $this->request['state']) !== $this->request['state']) { + // Error if state is not set, or doesn't match throw new LTI_Exception("State not found", 1); } return $this; @@ -369,4 +369,4 @@ private function validate_message() { } } -?> \ No newline at end of file +?>