Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-11717

View unanswered posts = General error

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-dev
    • Fix Version/s: 3.1.0-a1
    • Component/s: Other
    • Labels:
      None

      Description

      View unanswered posts and you get the following general error:

      General Error
      SQL ERROR [ mysqli ]

      Unknown column 't.topic_replies' in 'where clause' [1054]

      SQL

      SELECT DISTINCT t.topic_last_post_time, p.topic_id FROM phpbb_posts p, phpbb_topics t WHERE t.topic_replies = 0 AND t.topic_moved_id = 0 AND p.topic_id = t.topic_id AND (t.topic_visibility = 1 OR t.forum_id IN (1, 2)) ORDER BY t.topic_last_post_time DESC LIMIT 1001

      BACKTRACE

      FILE: (not given by php)
      LINE: (not given by php)
      CALL: msg_handler()

      FILE: [ROOT]/phpbb/db/driver/driver.php
      LINE: 809
      CALL: trigger_error()

      FILE: [ROOT]/phpbb/db/driver/mysqli.php
      LINE: 187
      CALL: phpbb_db_driver->sql_error()

      FILE: [ROOT]/phpbb/db/driver/mysql_base.php
      LINE: 48
      CALL: phpbb_db_driver_mysqli->sql_query()

      FILE: [ROOT]/phpbb/db/driver/driver.php
      LINE: 169
      CALL: phpbb_db_driver_mysql_base->_sql_query_limit()

      FILE: /phpbb3/phpbb/search.php
      LINE: 475
      CALL: phpbb_db_driver->sql_query_limit()

        Activity

        Hide
        Marc Marc added a comment -

        Please describe the exact steps needed to reproduce this bug. I was unable to reproduce it on the current develop with the information you provided.

        Show
        Marc Marc added a comment - Please describe the exact steps needed to reproduce this bug. I was unable to reproduce it on the current develop with the information you provided.
        Hide
        VSE Matt Friedman added a comment -

        Go to Area51 and click on view unanswered posts:
        http://area51.phpbb.com/phpBB/search.php?search_id=unanswered

        Show
        VSE Matt Friedman added a comment - Go to Area51 and click on view unanswered posts: http://area51.phpbb.com/phpBB/search.php?search_id=unanswered
        Hide
        bantu Andreas Fischer added a comment -

        ./search.php:						WHERE t.topic_replies = 0
        ./search.php:						WHERE t.topic_replies = 0
        ./includes/ucp/ucp_prefs.php:				$sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
        ./phpbb/feed/topic.php:		$sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_replies, t.topic_type

        Show
        bantu Andreas Fischer added a comment - ./search.php: WHERE t.topic_replies = 0 ./search.php: WHERE t.topic_replies = 0 ./includes/ucp/ucp_prefs.php: $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); ./phpbb/feed/topic.php: $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_replies, t.topic_type
        Hide
        VSE Matt Friedman added a comment - - edited

        Soft Delete dropped the topic_replies column

        Also found some others:

        ./develop/benchmark.php              ORDER BY topic_replies ASC LIMIT 1
        ./develop/benchmark.php              $sql .= ", topic_replies = topic_replies + 1 ";
        ./develop/merge_post_tables.php      SET topic_first_post_id = " . $row['first_post_id'] . ", topic_last_post_id = " . $row['last_post_id'] . ", topic_replies = " . ($row['total_posts'] - 1) . "
        ./includes/function_posting.php      $data['topic_replies']

        Show
        VSE Matt Friedman added a comment - - edited Soft Delete dropped the topic_replies column Also found some others: ./develop/benchmark.php ORDER BY topic_replies ASC LIMIT 1 ./develop/benchmark.php $sql .= ", topic_replies = topic_replies + 1 "; ./develop/merge_post_tables.php SET topic_first_post_id = " . $row['first_post_id'] . ", topic_last_post_id = " . $row['last_post_id'] . ", topic_replies = " . ($row['total_posts'] - 1) . " ./includes/function_posting.php $data['topic_replies']
        Hide
        Marc Marc added a comment - - edited

        phpBB/develop/benchmark.php seems to have been broken a while back. It's missin several dependencies and I'm not even sure if we still need it. This shouldn't be something to fix here. The same applies to phpBB/develop/merge_post_tables.php.

        I was able to find these occurences in the current develop:

        phpBB/includes/ucp/ucp_prefs.php:270:				$sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
        phpBB/includes/functions_posting.php:2010:	else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))
        phpBB/install/convertors/convert_phpbb20.php:500:				array('topic_posts_approved',	'topics.topic_replies + 1',			''),
        phpBB/install/convertors/convert_phpbb20.php:534:				array('topic_posts_approved',	'topics.topic_replies + 1',			''),
        phpBB/viewtopic.php:315:$topic_replies = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1;
        phpBB/viewtopic.php:428:	$total_posts = $topic_replies + 1;
        phpBB/search.php:369:						WHERE t.topic_replies = 0
        phpBB/search.php:381:						WHERE t.topic_replies = 0
        phpBB/develop/benchmark.php:173:		ORDER BY topic_replies ASC LIMIT 1";
        phpBB/develop/benchmark.php:278:			$sql .= ", topic_replies = topic_replies + 1 ";
        phpBB/develop/merge_post_tables.php:109:		SET topic_first_post_id = " . $row['first_post_id'] . ", topic_last_post_id = " . $row['last_post_id'] . ", topic_replies = " . ($row['total_posts'] - 1) . "
        phpBB/phpbb/feed/topic.php:46:		$sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_replies, t.topic_type
        phpBB/phpbb/db/migration/data/310/softdelete_p1.php:126:			SET topic_posts_approved = topic_replies + 1,
        phpBB/phpbb/db/migration/data/310/softdelete_p1.php:127:				topic_posts_unapproved = topic_replies_real - topic_replies
        phpBB/phpbb/db/migration/data/310/softdelete_p1.php:133:				topic_posts_unapproved = (topic_replies_real - topic_replies) + 1
        phpBB/phpbb/db/migration/data/310/dev.php:327:		$sql = 'SELECT topic_id, topic_approved, (topic_replies + 1) AS topic_posts, topic_last_post_id, topic_last_post_subject, topic_last_post_time, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour
        phpBB/phpbb/db/migration/data/310/softdelete_p2.php:31:				$this->table_prefix . 'topics'			=> array('topic_approved', 'topic_replies', 'topic_replies_real'),
        phpBB/phpbb/db/migration/data/310/softdelete_p2.php:54:					'topic_replies'				=> array('UINT', 0),
        phpBB/phpbb/db/migration/data/310/softdelete_p2.php:55:					'topic_replies_real'		=> array('UINT', 0),

        Remove the ones that are either conversions or shouldn't be covered by this leaves these:

        phpBB/includes/ucp/ucp_prefs.php:270:				$sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
        phpBB/includes/functions_posting.php:2010:	else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))
        phpBB/search.php:369:						WHERE t.topic_replies = 0
        phpBB/search.php:381:						WHERE t.topic_replies = 0
        phpBB/phpbb/feed/topic.php:46:		$sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_replies, t.topic_type
        

        Show
        Marc Marc added a comment - - edited phpBB/develop/benchmark.php seems to have been broken a while back. It's missin several dependencies and I'm not even sure if we still need it. This shouldn't be something to fix here. The same applies to phpBB/develop/merge_post_tables.php. I was able to find these occurences in the current develop: phpBB/includes/ucp/ucp_prefs.php:270: $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); phpBB/includes/functions_posting.php:2010: else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies'])) phpBB/install/convertors/convert_phpbb20.php:500: array('topic_posts_approved', 'topics.topic_replies + 1', ''), phpBB/install/convertors/convert_phpbb20.php:534: array('topic_posts_approved', 'topics.topic_replies + 1', ''), phpBB/viewtopic.php:315:$topic_replies = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1; phpBB/viewtopic.php:428: $total_posts = $topic_replies + 1; phpBB/search.php:369: WHERE t.topic_replies = 0 phpBB/search.php:381: WHERE t.topic_replies = 0 phpBB/develop/benchmark.php:173: ORDER BY topic_replies ASC LIMIT 1"; phpBB/develop/benchmark.php:278: $sql .= ", topic_replies = topic_replies + 1 "; phpBB/develop/merge_post_tables.php:109: SET topic_first_post_id = " . $row['first_post_id'] . ", topic_last_post_id = " . $row['last_post_id'] . ", topic_replies = " . ($row['total_posts'] - 1) . " phpBB/phpbb/feed/topic.php:46: $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_replies, t.topic_type phpBB/phpbb/db/migration/data/310/softdelete_p1.php:126: SET topic_posts_approved = topic_replies + 1, phpBB/phpbb/db/migration/data/310/softdelete_p1.php:127: topic_posts_unapproved = topic_replies_real - topic_replies phpBB/phpbb/db/migration/data/310/softdelete_p1.php:133: topic_posts_unapproved = (topic_replies_real - topic_replies) + 1 phpBB/phpbb/db/migration/data/310/dev.php:327: $sql = 'SELECT topic_id, topic_approved, (topic_replies + 1) AS topic_posts, topic_last_post_id, topic_last_post_subject, topic_last_post_time, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour phpBB/phpbb/db/migration/data/310/softdelete_p2.php:31: $this->table_prefix . 'topics' => array('topic_approved', 'topic_replies', 'topic_replies_real'), phpBB/phpbb/db/migration/data/310/softdelete_p2.php:54: 'topic_replies' => array('UINT', 0), phpBB/phpbb/db/migration/data/310/softdelete_p2.php:55: 'topic_replies_real' => array('UINT', 0), Remove the ones that are either conversions or shouldn't be covered by this leaves these: phpBB/includes/ucp/ucp_prefs.php:270: $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); phpBB/includes/functions_posting.php:2010: else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies'])) phpBB/search.php:369: WHERE t.topic_replies = 0 phpBB/search.php:381: WHERE t.topic_replies = 0 phpBB/phpbb/feed/topic.php:46: $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_replies, t.topic_type
        Hide
        nickvergessen Joas Schilling added a comment -

        viewtopic ones are correct as is.

        Show
        nickvergessen Joas Schilling added a comment - viewtopic ones are correct as is.

          People

          • Assignee:
            EXreaction EXreaction [X] (Inactive)
            Reporter:
            VSE Matt Friedman
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development