Fixed getAutoCompleteResults: array_merge(): Argument #2 must be of type array, null given

Xon

Well-known member
Affected version
2.3.4
getAutoCompleteResults isn't checking the return result of getAutoCompleteResult

getAutoCompleteResult has the type signature public function getAutoCompleteResult(Entity $entity,array $options = []): ?array;

But it is used as:
PHP:
    return array_filter(array_merge(
        [
            'id' => $result->getEntityContentTypeId(),
            'type' => \XF::app()->getContentTypePhrase($type),
        ],
        $handler->getAutoCompleteResult($result, $options)
    ));
Passing null to array_merge will cause an error.


This can happen when a thread doesn't have a first post. This can be caused by bad data, or a race between between when a thread is converted into a redirect but search hasn't been updated yet.
 
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.5).

Change log:
Fix handling of `null` auto-complete results
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom