Suggested Fix for Bounce Plugin on PHP 7.2

"Darren Holt" <[email protected]> Tue, 30 Oct 2018 14:11:51 -0500
Newsgroups gmane.mail.squirrelmail.plugins
Message-ID <35eade4c84a0da810ced798662362216.squirrel@ngmail.news-gazette.com>
Hello

I am subscribed to this mailing list.

  [x]  True - No need to CC me when replying
  [ ]  False - Please CC me when replying

This bug occurs when I ...
  ... use a plug-in

The description of the bug:
After upgrading PHP to v7.2, when using the "bounce" feature, a blank page
is shown and the message is not redirected.


I can reproduce the bug by:
Trying to send myself a bounced message.


(Optional) I got bored and found the bug occurs in:
.../squirrelmail/plugins/bounce/bounce_send.php

Here is the error from ssl_error_log:
[php7:error] [pid 1250] [client <IP REDACTED>:54130] PHP Fatal error: 
Uncaught Error: Call to undefined function ereg() in
/usr/share/squirrelmail/plugins bounce/bounce_send.php:123\nStack
trace:\n#0 {main}\n  thrown in
/usr/share/squirrelmail/plugins/bounce/bounce_send.php on line 123,
referer: https://<SERVERNAME REDACTED>/plugins/bounce
bounce.php?mailbox=INBOX&passed_id=106927&startMessage=1


(Optional) I got really bored and here's a fix:
Edit line 123:
if (ereg("^([^@%/]+)[@%/](.+)$", $username, $usernamedata)) {

to this:
if (preg_match("^([^@%/]+)[@%/](.+)$", $username, $usernamedata)) {

IE: replace the deprecated "ereg" function with "preg_match".


Thought this information might be helpful to someone else.

Darren Holt
I.T. Manager
News-Gazette Media
http://www.news-gazette.media/



-----
squirrelmail-plugins mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins