Skip to content

Fatal error: Uncaught mysqli_sql_exception from mailwatch_quarantine_report.php #1209

@dbworth

Description

@dbworth

Issue summary

I try to run the PHP script to generate a Quarantine report.

It fails with:

Fatal error: Uncaught mysqli_sql_exception: 
Expression #1 of ORDER BY clause is not in SELECT list, 
references column 'mailscanner.a.date' which is not in SELECT list; 
this is incompatible with DISTINCT in /var/www/html/MyMailWatchSystem/functions.php:1041

The full output is below.

Steps to reproduce

  1. MailWatch has 1 user called "MyAdminUser"

  2. In the User Manager, I tick the box "Send Daily Report" and set the recipient to an email address e.g. bob@bobs-burgers.com

  3. From the command line I run the script:
    $ php /usr/local/bin/mailwatch_quarantine_report.php

Expected result

I expect the script would finish with no error.

The "PHP Deprecated" warnings can be ignored, as mentioned here: #1176

Actual result

An exception is thrown:

 === Generating report for MyAdminUser type=A

 ==== Recipient e-mail address is bob@bobs-burgers.com

PHP Deprecated:  Function get_magic_quotes_gpc() is deprecated in /var/www/html/MyMailWatchSystem/functions.php on line 1106

Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/www/html/MyMailWatchSystem/functions.php on line 1106

 ==== Building list for 

PHP Fatal error:  Uncaught mysqli_sql_exception: Expression #1 of ORDER BY clause is not in SELECT list, references column 'mailscanner.a.date' which is not in SELECT list; this is incompatible with DISTINCT in /var/www/html/MyMailWatchSystem/functions.php:1041

Stack trace:

#0 /var/www/html/MyMailWatchSystem/functions.php(1041): mysqli->query()
#1 /var/www/html/MyMailWatchSystem/quarantine_report.inc.php(465): dbquery()
#2 /var/www/html/MyMailWatchSystem/quarantine_report.inc.php(374): Quarantine_Report::return_quarantine_list_array()
#3 /var/www/html/MyMailWatchSystem/quarantine_report.inc.php(321): Quarantine_Report::send_reports_for_user()
#4 /usr/local/bin/mailwatch_quarantine_report.php(48): Quarantine_Report->send_quarantine_reports()
#5 {main}

  thrown in /var/www/html/MyMailWatchSystem/functions.php on line 1041

Fatal error: Uncaught mysqli_sql_exception: Expression #1 of ORDER BY clause is not in SELECT list, references column 'mailscanner.a.date' which is not in SELECT list; this is incompatible with DISTINCT in /var/www/html/MyMailWatchSystem/functions.php:1041

Stack trace:

#0 /var/www/html/MyMailWatchSystem/functions.php(1041): mysqli->query()
#1 /var/www/html/MyMailWatchSystem/quarantine_report.inc.php(465): dbquery()
#2 /var/www/html/MyMailWatchSystem/quarantine_report.inc.php(374): Quarantine_Report::return_quarantine_list_array()
#3 /var/www/html/MyMailWatchSystem/quarantine_report.inc.php(321): Quarantine_Report::send_reports_for_user()
#4 /usr/local/bin/mailwatch_quarantine_report.php(48): Quarantine_Report->send_quarantine_reports()
#5 {main}

  thrown in /var/www/html/MyMailWatchSystem/functions.php on line 1041

Installation

Version and method

  • MailWatch stable 1.2.16
  • Installed from tarball
  • Fresh install

Server configuration

  • Ubuntu 20.04.2
  • PHP 7.4.3
  • MySQL 8.0.23-0
  • Postfix 3.4.13
  • Apache 2.4.41

Client configuration

  • Operation System: N/A
  • Browser: N/A

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions