Suppress bogus PHP imap_open() Notice: insecure server advertised AUTH=PLAIN

前端 未结 3 1516
攒了一身酷
攒了一身酷 2021-01-04 13:59

I\'m getting a mess of these bogus warnings in my log file, and I’d like to suppress them without suppressing legitimate messages:

PHP Notice: Unknown: SECU

3条回答
  •  长发绾君心
    2021-01-04 14:09

    As deceze said, it's not really a "bogus" message, it just means that it's a plaintext unencrypted connection. Here is how you can do :

    $error = imap_errors();
    if (count($error) > 1 || $error[0] != 'SECURITY PROBLEM: insecure server advertised AUTH=PLAIN') {
      // More than 1 error or not the expected error
      var_dump($error);
      throw new Exception('IMAP error detected');
    }
    

提交回复
热议问题