Guest content may prevent search suggestions from being displayed

Kirby

Well-known member
Affected version
2.3.6
PHP:
$iconHtml = null;
$templater = \XF::app()->templater();
if ($user)
{
    $iconHtml = $templater->func('avatar', [
        $user,
        'xxs',
        false,
        ['href' => ''],
    ]);
}

return [
    'text' => $text,
    'url' => $url,
    'iconHtml' => $iconHtml,
    'desc' => $desc,
];

This sets iconHtml to null if the content was created by a guest which later on casues an exception when rendering the Mustache template.

Suggested Fix
1) Pass a guest user entity with the correct Username
or
2) Add an additional param for the guest username and change the above code to pass that to templater function avatar
 
Back
Top Bottom