SimpleMachines / SMF

Simple Machines Forum — SMF in short — is free and open-source community forum software, delivering professional grade features in a package that allows you to set up your own online community within minutes!
https://www.simplemachines.org/
Other
584 stars 250 forks source link

[3.0]: Database Error: Unknown column 'b.member_groups' in 'field list' #8300

Open sbulen opened 1 month ago

sbulen commented 1 month ago

Basic Information

This error is logged pretty much any time a notification is sent out by CreatePost-Notify.php.

Apologies if this is a dupe - I swore this was logged earlier, but cannot find it.

Steps to reproduce

  1. Have a user subscribe to a thread
  2. Post in that thread

Expected result

User notification

Actual result

Errors logged

Version/Git revision

3.0 Alpha 2

Database Engine

All

Database Version

8.4

PHP Version

8.3.8

Logs

Guest
127.0.0.1
http://localhost/84van30/cron.php
D:/wamp64/www/84van30/Sources/Tasks/CreatePost_Notify.php (Line 158)
Backtrace information

Type of error: Database
Error message Select
Database Error: Unknown column 'b.member_groups' in 'field list'

Additional Information

No response

Oldiesmann commented 4 weeks ago

It appears we should have an INNER JOIN {db_prefix}boards AS b ON (b.id_board = ln.id_board) (or possibly t.id_board instead?) in there, but we don't. However, none of the code after this query references "member_groups" at all.

        // Find the people interested in receiving notifications for this topic
        $request = Db::$db->query(
            '',
            'SELECT
                ln.id_member, ln.id_board, ln.id_topic, ln.sent,
                mem.email_address, mem.lngfile, mem.pm_ignore_list,
                mem.id_group, mem.id_post_group, mem.additional_groups,
                mem.time_format, mem.time_offset, mem.timezone,
                b.member_groups, t.id_member_started, t.id_member_updated
            FROM {db_prefix}log_notify AS ln
                INNER JOIN {db_prefix}members AS mem ON (ln.id_member = mem.id_member)
                LEFT JOIN {db_prefix}topics AS t ON (t.id_topic = ln.id_topic)
            WHERE ' . ($type == 'topic' ? 'ln.id_board = {int:board}' : 'ln.id_topic = {int:topic}') . '
                AND ln.id_member != {int:member}',
            [
                'member' => $posterOptions['id'],
                'topic' => $topicOptions['id'],
                'board' => $topicOptions['board'],
            ],
        );