AddonsLab
Well-known member
- Affected version
- 2.2.6 Patch 1
If an activity summary section has a custom title with a "dot" in it, e.g. "Second thread with very long title. Another title here" sending a test email generates the following PHP error:
InvalidArgumentException: Phrase rendering error: Phrase group Second thread with very long title is not a valid format src/XF/Language.php:278
It seems the reason is that in the file src/XF/ActivitySummary/Instance.php the text is used as a phrase:#0 src/XF/Language.php(247): XF\Language->loadPhraseGroup('Second thread w...')#1 src/XF/Language.php(130): XF\Language->getPhraseText('Second thread w...')
#2 src/XF/Phrase.php(52): XF\Language->renderPhrase('Second thread w...', Array, 'html', Array)
#3 src/XF/Phrase.php(59): XF\Phrase->render()
#4 src/XF.php(1169): XF\Phrase->__toString()
#5 src/XF/Template/Templater.php(1194): XF::escapeString(Object(XF\Phrase), 'html')
#6 internal_data/code_cache/templates/l1/s1/email/activity_summary.php(28): XF\Template\Templater->escape(Object(XF\Phrase))
#7 src/XF/Template/Templater.php(1644): XF\Template\Templater->{closure}(Object(XF\Mail\Templater), Array, NULL)
#8 src/XF/Mail/Mailer.php(216): XF\Template\Templater->renderTemplate('activity_summar...', Array)
#9 src/XF/Mail/Mailer.php(150): XF\Mail\Mailer->renderPartialMailTemplate('activity_summar...', Array, Object(XF\Language), Object(CG\UserReward\XF\Entity\User))
#10 src/XF/Mail/Mail.php(335): XF\Mail\Mailer->renderMailTemplate('activity_summar...', Array, Object(XF\Language), Object(CG\UserReward\XF\Entity\User))
#11 src/XF/Mail/Mail.php(403): XF\Mail\Mail->renderTemplate()
#12 src/XF/Mail/Mail.php(417): XF\Mail\Mail->getSendableMessage()
#13 src/addons/AL/TestFramework/XF/Mail/Mail.php(24): XF\Mail\Mail->send(NULL, true)
#14 src/XF/Job/ActivitySummaryEmail.php(121): AL\TestFramework\XF\Mail\Mail->send()
#15 src/XF/Job/ActivitySummaryEmail.php(67): XF\Job\ActivitySummaryEmail->generateAndSendEmail(Object(CG\UserReward\XF\Entity\User))
#16 src/XF/Job/Manager.php(258): XF\Job\ActivitySummaryEmail->run(7.99999)
#17 src/XF/Job/Manager.php(200): XF\Job\Manager->runJobInternal(Array, 7.99999)
#18 src/XF/Job/Manager.php(116): XF\Job\Manager->runJobEntry(Array, 7.99999)
#19 src/XF/Admin/Controller/Tools.php(120): XF\Job\Manager->runByIds(Array, 8)
#20 src/XF/Mvc/Dispatcher.php(350): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#21 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(CG\AttachmentEssentials\XF\Admin\Controller\Tools), NULL)
#22 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(CG\AttachmentEssentials\XF\Admin\Controller\Tools), NULL)
#23 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#24 src/XF/App.php(2344): XF\Mvc\Dispatcher->run()
#25 src/XF.php(512): XF\App->run()
#26 admin.php(13): XF::runApp('XF\\Admin\\App')
#27 {main}
Code:
public function addDisplayValue($label, $value)
{
if (!($label instanceof \XF\Phrase))
{
$label = \XF::phrase($label);
}
$this->displayValues[] = [
'label' => $label,
'value' => $value
];
}