Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mailwatch_sendmail_queue.php does not accomodate SRS recipient addresses #1290

Closed
andrewt918 opened this issue Nov 6, 2023 · 3 comments · Fixed by #1291
Closed

mailwatch_sendmail_queue.php does not accomodate SRS recipient addresses #1290

andrewt918 opened this issue Nov 6, 2023 · 3 comments · Fixed by #1291

Comments

@andrewt918
Copy link

andrewt918 commented Nov 6, 2023

The rcpts regex in mailwatch_sendmail_queue.php (line 82) does not allow for an equals sign as is present in SRS addresses. With PHP 8.0 and higher this will result in the following error since the case to set $output[$msgid]['rcpts'] is never met:

Fatal error: Uncaught TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in /usr/local/bin/mailwatch_sendmail_queue.php:277 Stack trace: #0 /usr/local/bin/mailwatch_sendmail_queue.php(277): implode() #1 {main} thrown in /usr/local/bin/mailwatch_sendmail_queue.php on line 277

Prior to PHP 8.0, the @implode suppressed this issue per the PHP docs:

https://www.php.net/manual/en/language.operators.errorcontrol.php

Warning Prior to PHP 8.0.0, it was possible for the @ operator to disable critical errors that will terminate script execution. For example, prepending @ to a call of a function which did not exist, by being unavailable or mistyped, would cause the script to terminate with no indication as to why.

We ran into this after migrating our install to an updated OS with PHP 8.0 instead of PHP 7.2.

@andrewt918
Copy link
Author

Same issue with supporting plus addressing.

@endelwar
Copy link
Member

endelwar commented Nov 7, 2023

I assume that you are using exim. I've added a pr with a better regex, could you test it (postfix user here 😄)?

@andrewt918
Copy link
Author

Yes, this is with Exim and that regex works fine. It's practically identical to the change I already made on our own instance. I just submitted the issue to get a fix added and as a heads up for anyone else that runs into this meanwhile.

Probably worth considering additional error handling for the @implode to prevent fatal errors on edge cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants