The error occurs especially when a forum has subforums and also his own topics.
According to ours tests, this iterative approach is less resource consuming comparing with the initial recursive code.
Thanks for the patch, it appears to be working for me.
Automatically closed -- issue fixed for 2 weeks with no activity.
Drupal is a registered trademark of Dries Buytaert.