Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-16095

Watched topics can generate duplicate rows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.2.7
    • None

      I have a client that was getting duplicate rows in the list of watched topics (UCP > Manage subscriptions). After going through extensive work to ensure there was not duplicate data in his tables, I also recreated his indexes for the topics_watch, topics, forums, forums_track, topics_track and topics_posted tables from a reference database. I printed the $sql variable to the screen that appears around line 882 in /includes/ucp/ucp_main.php and tested that SQL in phpMyAdmin to verify duplicate rows were created by this SQL. The SQL is a little suspicious because it uses a CROSS JOIN which is later sort of undone in the SQL in the WHERE clause: AND t.topic_id = tw.topic_id.

      My solution was to use SELECT_DISTINCT instead of SELECT on line 882 of /includes/ucp/ucp_main.php as follows:

      $sql = $db->sql_build_query('SELECT_DISTINCT', $sql_array);

      I don't think adding this should introduce any problem, so I hope it can be prioritized to the next release so subsequent updates to phpBB won't overwrite my patch. I didn't check, but there may be a similar issue with the SQL for watched forums. If so this approach might work there as well.

            Unassigned Unassigned
            MarkDHamill MarkDHamill
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: