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

PHPBB3-12613