I'm running SMF 2.0.18, PHP 7.4, and nginx/1.18.0 (Ubuntu) . I'm seeing these two errors in my error log when the mail queue is processed as part of a scheduled task:
450 4.1.2 <firstname.lastname@example.org>: Recipient address rejected: Domain not found
8: Trying to access array offset on value of type null
The SMTP error is produced because the forum user's email address is invalid and the email can't be delivered. It's a legitimate error that the user needs to address by updating the email address associated with their forum profile.
Here's the code from Subs-Post.php:
1428 // Parse a message to the SMTP server.
1429 function server_parse($message, $socket, $response)
1431 global $txt;
1433 if ($message !== null)
1434 fputs($socket, $message . "\r\n");
1436 // No response yet.
1437 $server_response = '';
1439 while (substr($server_response, 3, 1) != ' ')
1440 if (!($server_response = fgets($socket, 256)))
1442 // !!! Change this message to reflect that it may mean bad user/password/server issues/etc.
1444 return false;
1447 if ($response === null)
1448 return substr($server_response, 0, 3);
1450 if (substr($server_response, 0, 3) != $response)
1452 log_error($txt['smtp_error'] . $server_response);
1453 return false;
1456 return true;
I'm using the default theme with English language text. To reproduce this error, enqueue a message and process the queue as part of a scheduled task. The error does not occur when the queue is processed manually as part of a logged-in administrator session.
PHP 7.4 includes a backwards-incompatible change associated with trying to use values of type null, bool, int, float or resource as an array as described here:
Is it correct to assume that the index.english.php file doesn't get loaded as part of running a scheduled task and the $txt array is never initialized with values? If so, that would explain the error. $txt is null, and the attempt to reference $txt['smtp_error'] causes the error to be raised and the notice logged. It seems to be harmless beyond the failure to include the value of $txt['smtp_error'] in the logged error message and the extra notice being logged.
QuoteIs it correct to assume that the index.english.php file doesn't get loaded as part of running a scheduled task and the $txt array is never initialized with values?
yeah, seems like it. I think that whoever wrote the task scheduler thought teat tasks would never need any languages. Actually the task runner doesn't load much and thus produces random errors that we had to duct-tape fix.