[ticket/12613] Fix functional test and post sorting bug

PHPBB-12613