Phpservermon: Error: Class 'PHPMailer' not found v3.3

Created on 6 Jun 2018  路  4Comments  路  Source: phpservermon/phpservermon

Hi Guys,

I upgraded to new version 3.3 and after do that emails donts works! I try to send a test and returns this message. My php is 7.1.17.

Fatal error: Uncaught Error: Class 'PHPMailer' not found in /var/www/html/phpmonitor/src/includes/functions.inc.php:489 Stack trace: #0 /var/www/html/phpmonitor/src/psm/Module/Config/Controller/ConfigController.php(233): psm_build_mail() #1 /var/www/html/phpmonitor/src/psm/Module/Config/Controller/ConfigController.php(198): psm\Module\Config\Controller\ConfigController->testEmail() #2 /var/www/html/phpmonitor/src/psm/Module/AbstractController.php(193): psm\Module\Config\Controller\ConfigController->executeSave() #3 /var/www/html/phpmonitor/src/psm/Module/AbstractController.php(164): psm\Module\AbstractController->runAction('save') #4 /var/www/html/phpmonitor/src/psm/Router.php(102): psm\Module\AbstractController->run('save') #5 /var/www/html/phpmonitor/index.php(42): psm\Router->run('config') #6 {main} thrown in /var/www/html/phpmonitor/src/includes/functions.inc.php on line 489

Thanks in advance.

bug

Most helpful comment

Hi Guys,

I founded a solution for this case...

line 489
src/includes/functions.inc.php

$phpmailer = new \PHPMailer\PHPMailer\PHPMailer();
solution founded: https://stackoverflow.com/questions/28906487/fatal-error-class-phpmailer-not-found

and
line 170
../src/psm/Router.php +170

        //if(!hash_equals(
                                //      hash_hmac('sha256', $csrf_key, $session->get('csrf_token2')),
                                //      $token_in
                                //)) {
                                //      throw new \InvalidArgumentException('invalid_csrf_token');
                                //}

// CHANGE START
if(!function_exists('hash_equals')) {
  function hash_equals($str1, $str2) {
    if(strlen($str1) != strlen($str2)) {
      return false;
    } else {
      $res = $str1 ^ $str2;
      $ret = 0;
      for($i = strlen($res) - 1; $i >= 0; $i--) $ret |= ord($res[$i]);
      return !$ret;
    }
  }
}
//CHANGE END

solution founded: http://php.net/manual/en/function.hash-equals.php

SMTP emails works again!!!

Regards

All 4 comments

Hi Guys,

I founded a solution for this case...

line 489
src/includes/functions.inc.php

$phpmailer = new \PHPMailer\PHPMailer\PHPMailer();
solution founded: https://stackoverflow.com/questions/28906487/fatal-error-class-phpmailer-not-found

and
line 170
../src/psm/Router.php +170

        //if(!hash_equals(
                                //      hash_hmac('sha256', $csrf_key, $session->get('csrf_token2')),
                                //      $token_in
                                //)) {
                                //      throw new \InvalidArgumentException('invalid_csrf_token');
                                //}

// CHANGE START
if(!function_exists('hash_equals')) {
  function hash_equals($str1, $str2) {
    if(strlen($str1) != strlen($str2)) {
      return false;
    } else {
      $res = $str1 ^ $str2;
      $ret = 0;
      for($i = strlen($res) - 1; $i >= 0; $i--) $ret |= ord($res[$i]);
      return !$ret;
    }
  }
}
//CHANGE END

solution founded: http://php.net/manual/en/function.hash-equals.php

SMTP emails works again!!!

Regards

Could you maybe pull the develop branch and test it for me? Curious to know if it's working right now.

I hope that you have some spare time to test it :). I can not test it myself right now.

Hi Tim,

Yes, works good for me right now. But like I said before I only changed the "hash_equals" functions and commented the "original code".

Regards,

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nitrocode picture nitrocode  路  10Comments

yalgva picture yalgva  路  7Comments

gustavomacedo picture gustavomacedo  路  8Comments

dmonaay picture dmonaay  路  7Comments

ptrj picture ptrj  路  3Comments