[ticket/12508] Correctly add components to query

PHPBB3-12508