Skip to content
Snippets Groups Projects
Commit 035eabd5 authored by JediKev's avatar JediKev
Browse files

issue: sendAccessLink On NULL v1.11

This addresses an issue in v1.11 where sending an Access Link via email to a
Collaborator fails with fatal error. This is due to the type of User class
that is sent to the `Mailer::send()` function. The ClientSession User class
is not appropriate for this method, rather, TicketOwner or Collaborator User
classes are appropriate. This adds a function called `getSessionUser()` to
the ClientSession class so we can retrieve the TicketOwner/Collaborator User
class from the session.
parent 6e7e9b45
No related branches found
No related tags found
No related merge requests found
...@@ -406,6 +406,8 @@ class Mailer { ...@@ -406,6 +406,8 @@ class Mailer {
if (!is_array($recipients) && (!$recipients instanceof MailingList)) if (!is_array($recipients) && (!$recipients instanceof MailingList))
$recipients = array($recipients); $recipients = array($recipients);
foreach ($recipients as $recipient) { foreach ($recipients as $recipient) {
if ($recipient instanceof ClientSession)
$recipient = $recipient->getSessionUser();
switch (true) { switch (true) {
case $recipient instanceof EmailRecipient: case $recipient instanceof EmailRecipient:
$addr = sprintf('"%s" <%s>', $addr = sprintf('"%s" <%s>',
......
...@@ -123,6 +123,10 @@ class ClientSession extends EndUser { ...@@ -123,6 +123,10 @@ class ClientSession extends EndUser {
$this->session= new UserSession($user->getId()); $this->session= new UserSession($user->getId());
} }
function getSessionUser() {
return $this->user;
}
function isValid(){ function isValid(){
global $_SESSION,$cfg; global $_SESSION,$cfg;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment