1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed XenForo_Model_Thread::rebuildThreadUserPostCounters

Discussion in 'Resolved Bug Reports' started by stefan1989, Apr 12, 2013.

  1. stefan1989

    stefan1989 New Member

    Hello,

    I have found an issue in the method XenForo_Model_Thread::rebuildThreadUserPostCounters.

    Method:
    PHP:
        public function rebuildThreadUserPostCounters($threadId$userId null)
        {
            if (
    $userId === 0)
            {
                return;
            }
     
            
    $db $this->_getDb();
           
            
    $records $db->fetchPairs('
                SELECT user_id, COUNT(*)
                FROM xf_post
                WHERE thread_id = ?
                    AND message_state = \'visible\'
                    ' 
    . ($userId !== null ' AND user_id = ' $db->quote($userId) : '') . '
                GROUP BY user_id
            '
    );
     
            
    $this->replaceThreadUserPostCounters($threadId$records$userId);
        }
    Error:
    Code:
    Mysqli statement execute error : No data supplied for parameters in prepared statement 
    It's a simple solution to solve this issue but I think it's good to know for you, so you can release the bugfix in the next version.

    Solution:
    The error already tells the solution. The $threadId variable is missing at the end of the MySQL statement.

    I hope I could help you.
     
  2. Mike

    Mike XenForo Developer Staff Member

    Fixed, thanks.
     

Share This Page