Suppress dummy PHP imap_open () Note: an insecure server is advertised AUTH = PLAIN

I get a mess of these false warnings in my log file, and Id seems to suppress them without suppressing legitimate messages:

PHP Note: Unknown: SECURITY PROBLEM: Insecure server advertised by AUTH = PLAIN (errflg = 1) to Unknown on line 0

(Im connecting to an IMAP service that only listens on localhost on a server without third-party users.)

+8
php imap
source share
3 answers

One thing you can do is use imap_errors and imap_alerts , put this code in front of your imap_close.

imap_errors(); imap_alerts(); 

What these functions do is to return all errors and warnings that have occurred, and then reset them. If you do not call these functions, they are issued as notifications when imap_close () is called, or the page dies.

+15
source share

As deceze said, this is not really a β€œdummy” message, it just means that it is an unencrypted clear-text connection. Here's how you can do it:

 $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'); } 
+2
source share

You can get all warnings and errors when suppressing notifications using this:

 error_reporting(E_ALL & ~E_NOTICE & ~E_USER_NOTICE); 

Flag bit error messages:

 Error Bit Purpose
 ####################################################### ################################
 E_ALL All errors and warnings (doesn't include E_STRICT)
 ####################################################### ################################
 E_ERROR Fatal run-time errors
 ####################################################### ################################
 E_WARNING Run-time warnings (non-fatal errors)
 ####################################################### ################################
 E_PARSE Compile-time parse errors
 ####################################################### ################################
 E_NOTICE Run-time notices (these are warnings which often result 
                     from a bug in your code, but it possible that it was 
                     intentional (eg, using an uninitialized variable and 
                     relying on the fact it automatically initialized to 
                     an empty string)
 ####################################################### ################################
 E_STRICT Run-time notices, enable to have PHP suggest changes to 
                     your code which will ensure the best interoperability 
                     and forward compatibility of your code.
 ####################################################### ################################
 E_CORE_ERROR Fatal errors that occur during PHP initial startup
 ####################################################### ################################
 E_CORE_WARNING Warnings (non-fatal errors) that occur during PHP 
                     initial startup
 ####################################################### ################################
 E_COMPILE_ERROR Fatal compile-time errors
 ####################################################### ################################
 E_COMPILE_WARNING Compile-time warnings (non-fatal errors)
 ####################################################### ################################
 E_USER_ERROR User-generated error message
 ####################################################### ################################
 E_USER_WARNING User-generated warning message
 ####################################################### ################################
 E_USER_NOTICE User-generated notice message
 ####################################################### ################################

You can also set ignore_repeated_errors to TRUE / 1 so that it does not flood your log.

 ini_set('ignore_repeated_errors',1); 
+1
source share

All Articles