Fixed generateEmailData does not reliably restore the original language

Xon

Well-known member
Affected version
2.3.7
The generateEmailData function doesn't wrap a try/finally around the handling of the setLanguage calls, meaning if the code inside this method throws an exception the global language may have changed unexpectedly.

This matters as by default job.php will execute multiple jobs via runJobInternal which may have the underlying language unexpectedly change. Maybe runJobInternal should restore the language to whatever was at the start and clear any visitor object to guard against these leaks?

PHP:
protected function generateEmailData(User $user)
{
    $originalLanguage = \XF::language();
    \XF::setLanguage(\XF::app()->userLanguage($user));

...
    \XF::setLanguage($originalLanguage);

    return $instance;
}
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.8).

Change log:
Ensure language state is always restored in between generating activity summary emails
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom