Fixed XenForo_Model_Thread::rebuildThreadUserPostCounters

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.
 
Top Bottom