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

UCP Main Error if no forums exist

XMLWordPrintable

      The following code results in an error if forum_ary is empty, since sql_in_set does not allow empty arrays by default.

      Instead $db->sql_in_set('t.forum_id', $forum_ary, false, true) can be used to simply return no results on empty array, which makes it work. Or the query could be skipped entirely if no forums were found. One should probably also review the rest of that code to make sure it handles an empty forum list correctly.

      				// Get cleaned up list... return only those forums having the f_read permission
      				$forum_ary = $auth->acl_getf('f_read', true);
      				$forum_ary = array_unique(array_keys($forum_ary));
       
      				$sql = "SELECT t.* $sql_select
      					FROM $sql_from
      					WHERE t.topic_type = " . POST_GLOBAL . '
      						AND ' . $db->sql_in_set('t.forum_id', $forum_ary) . '
      					ORDER BY t.topic_last_post_time DESC';
      

            bantu Andreas Fischer [X] (Inactive)
            naderman Nils Adermann
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: