SQL error DUPLICATE for KEY in FORUMS_TRACK_TABLE

Details

Description

Hello,

I have found certain situations where marking forums read (viewforum.php?f=xx&mark=forums) would generate an SQL error DUPLICATE ERROR for KEY 'PRIMARY' in the forums_track table. In my case, this has happened when nesting multiple forums within other forums.

The stack trace shows that this is happening in the [i]markread()[/i] function within [b]includes/functions.php[/b].

And I have isolated the problem to cases where the [i]$forum_id[/i] variable holds an array with duplicate entries, that creates an issue when finally inserting through the call to [i]sql_multi_insert(FORUMS_TRACK_TABLE, $sql_ary)[/i]

So, I have applied a change to eliminate these duplicates, seems to work, but would like to know if someone sees any issue with this fix.

What I have done is the following:
find:[code] if (!is_array($forum_id))

{
$forum_id = array($forum_id);
}

[/code]
add after:[code] else

{
$forum_id = array_unique($forum_id);
}

[/code]
Any reason why this should not be applied? Would this be something that should be applied to the base phpbb code as a bug fix?
Thanks,
-javiexin