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

Merging unapproved post causes database error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 3.0.5
    • 3.0.x
    • None
    • PHP Environment:
      Database:

      I found this bug due to this topic. As you can see, the first two posts are similar, but different. They were originally started as two topics, which I merged into one. The user had 0 posts are therefore both posts (in separate topics) needed to be approved

      The following steps were taken:
      1) Approved post 1 (in topic 1)
      2) Merged post 2 (in topic 2) into topic 1 using the "merge posts" feature.
      3) At this point, both post 1 and post 2 are in topic 1 (topic 2 is gone), but post 2 is unapproved.
      4) Post 2 was then approved

      All seemed to be fine, but the unapproved icon indicator in viewforum never went away (see attached Screenshot1.png). The link just goes to a "There are no posts waiting for approval." page.

      I was able to reproduce this and stumbled upon another (probably related) issue. After completing the steps listed above on a new post1 and post2, I attempted to delete post1 (which should result in the topic only containing post 2). This resulted in the following:

      SQL ERROR [ mysqli ]
       
      Out of range value adjusted for column 'topic_replies' at row 1 [1264]
       
      SQL
       
      UPDATE community_topics SET topic_bumped = 0, topic_bumper = 0, topic_replies_real = topic_replies_real - 1, topic_replies = topic_replies - 1, topic_last_post_id = 8820055, topic_last_post_subject = 'Max number of users on PHPBB at once?', topic_last_post_time = 1236243960, topic_last_poster_id = 911615, topic_last_poster_colour = '', topic_last_poster_name = 'exul8891' WHERE topic_id = 1480945
       
      BACKTRACE
       
      FILE: includes/db/mysqli.php
      LINE: 163
      CALL: dbal->sql_error()
       
      FILE: includes/functions_posting.php
      LINE: 1531
      CALL: dbal_mysqli->sql_query()
       
      FILE: posting.php
      LINE: 1440
      CALL: delete_post()
       
      FILE: posting.php
      LINE: 278
      CALL: handle_post_delete()

      So topic_replies was not properly updated when the unapproved post was moved into the topic.

      Let me know if you need any other info

            TerraFrost TerraFrost
            Marshalrusty Yuriy Rusko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: