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

Send A Test Email stops working under PHP 7.3 #2523

Closed
justmace opened this issue Mar 15, 2019 · 10 comments
Closed

Send A Test Email stops working under PHP 7.3 #2523

justmace opened this issue Mar 15, 2019 · 10 comments
Assignees
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@justmace
Copy link

Describe the bug
I'm using cacti 1.2.2.
With PHP 7.1 and 7.2, the test email works perfectly, but as soon as I upgraded it to PHP 7.3 it stopped working ( log section above )
Tried clean installs with PHP 7.1, 7.2 and 7.3, it only failed with PHP 7.3.
( btw, tried all mail services, the results are the same)

To Reproduce
Steps to reproduce the behavior ( with PHP 7.3 ):

  1. Go to 'Settings->Mail/Reporting/DNS'
  2. Complete the fields
  3. Click 'Send a Test Email'
  4. See error

Expected behavior

(Cacti log)
2019/03/14 16:58:00 - MAILER WARNING: Mail failed via PHP Mail() Function from 'Cacti something@gmail.com', to '', cc '', Subject 'Cacti Test Message', Error: You must provide at least one recipient email address.
2019/03/14 16:58:00 - CMDPHP PHP ERROR WARNING Backtrace: (/settings.php[254]:email_test(), /lib/functions.php[3837]:send_mail(), /lib/functions.php[3263]:mailer(), /lib/functions.php[3418]:parse_email_details(), /lib/functions.php[3637]:split_emaildetail(), /lib/functions.php[3683]:preg_match(), CactiErrorHandler())
2019/03/14 16:58:00 - ERROR PHP WARNING: preg_match(): Compilation failed: invalid range in character class at offset 29 in file: /usr/share/cacti/lib/functions.php on line: 3683
2019/03/14 16:58:00 - CMDPHP PHP ERROR WARNING Backtrace: (/settings.php[254]:email_test(), /lib/functions.php[3837]:send_mail(), /lib/functions.php[3263]:mailer(), /lib/functions.php[3386]:parse_email_details(), /lib/functions.php[3637]:split_emaildetail(), /lib/functions.php[3683]:preg_match(), CactiErrorHandler())
2019/03/14 16:58:00 - ERROR PHP WARNING: preg_match(): Compilation failed: invalid range in character class at offset 29 in file: /usr/share/cacti/lib/functions.php on line: 3683
2019/03/14 16:58:00 - CMDPHP PHP ERROR WARNING Backtrace: (/settings.php[254]:email_test(), /lib/functions.php[3837]:send_mail(), /lib/functions.php[3263]:mailer(), /lib/functions.php[3386]:parse_email_details(), /lib/functions.php[3637]:split_emaildetail(), /lib/functions.php[3683]:preg_match(), CactiErrorHandler())
2019/03/14 16:58:00 - ERROR PHP WARNING: preg_match(): Compilation failed: invalid range in character class at offset 29 in file: /usr/share/cacti/lib/functions.php on line: 3683

Desktop (please complete the following information):

  • OS: RHEL 7.4/ CentOS 7.4
  • Browser: Chrome / Firefox
  • Version: 73 / 65

Additional context
The problem might start somewhere in the function 'parse_email_details', I'll investigate a bit more as well.

@cigamit
Copy link
Member

cigamit commented Mar 15, 2019

I'm voting for a PHP preg bug, but who knows.

@cigamit cigamit added the unverified Some days we don't have a clue label Mar 15, 2019
@justmace
Copy link
Author

justmace commented Mar 18, 2019

I tested the preg_match here and also found this bug report on PHP website.

@OberonX
Copy link

OberonX commented Mar 27, 2019

hello, I am using version 1.2.2 from Debian and I have the same problem. I have gone up to 1.2.3 from GIT and I get the same error line: functions.php [3637]: split_emaildetail (), / lib / functions .php [3683]: preg_match (), CactiErrorHandler ()) etc,

@cigamit
Copy link
Member

cigamit commented Mar 27, 2019

This is a bug in PHP 7.3 and not in Cacti. I would suggest that you open a Debian bug.

@cigamit cigamit added 3rd Party Bug 3rd party bug and removed unverified Some days we don't have a clue labels Mar 27, 2019
@OberonX
Copy link

OberonX commented Mar 27, 2019

Hello thank you, I have disabled 7.3 to use 7.0 in Apache, Regards! ...

@cigamit
Copy link
Member

cigamit commented Mar 27, 2019

I'm going to keep this open for others. No need to close for now.

@netniV
Copy link
Member

netniV commented Mar 27, 2019

I will be testing this soon as I'm going to run a 1.3 development server on 7.3 to see what issues I get.

@netniV netniV self-assigned this Mar 27, 2019
@netniV netniV added this to the v1.3.0 milestone Mar 27, 2019
@OberonX
Copy link

OberonX commented Apr 16, 2019

hi !

I fixed this issue replacing regexp

$sPattern = '/([\w\s'"+]+[\s]+)?(<)?(([\w-.+]+)@((?:[\w-]+.)+)([a-zA-Z]{2,4}))?(>)?/';

with

$sPattern = '/([\w\s\'\"\+]+[\s]+)?(<)?(([\w\-.\+]+)@((?:[\w\-]+\.)+)([a-zA-Z]{2,4}))?(>)?/';

it works on Debian/Sid php7.3

::: Before replace REGEXP:

2019/04/16 15:02:41 - CMDPHP PHP ERROR WARNING Backtrace: (/settings.php[254]:email_test(), /lib/functions.php[3837]:send_mail(), /lib/functions.php[3263]:mailer(), /lib/functions.php[3418]:parse_email_details(), /lib/functions.php[3637]:split_emaildetail(), /lib/functions.php[3683]:preg_match(), CactiErrorHandler())

::after

2019/04/16 15:08:39 - MAILER INFO: Mail successfully sent via Función Mail() de PHP from 'emx --- oberon@unixmexico.org', to 'oberon@unixmexico.org', cc '', Subject 'Mensaje de prueba de Cact

cigamit added a commit that referenced this issue Apr 17, 2019
Test email failure on PHP 7.3
@TheWitness
Copy link
Member

Okay, your corrected syntax is right.

@TheWitness TheWitness added bug Undesired behaviour resolved A fixed issue and removed 3rd Party Bug 3rd party bug labels Apr 17, 2019
@TheWitness TheWitness modified the milestones: v1.3.0, v1.2.4 Apr 17, 2019
@justmace
Copy link
Author

Works on my side, thanks ! If you want me to close this one, let me know.

@cigamit cigamit closed this as completed Apr 25, 2019
@netniV netniV changed the title Test email failure on PHP 7.3 Send A Test Email stops working under PHP 7.3 Apr 28, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

5 participants