Question: 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: SECURITY PROBLEM: insecure server advertised AUTH=PLAIN (errflg=1) in Unknown on line 0**

(I’m connecting to an IMAP service that is only listening to localhost on a server with no third-party users.)

Answer: 
One thing you can do is use the [imap\_errors](http://us3.php.net/manual/en/function.imap-errors.php) and [imap\_alerts](http://us3.php.net/manual/en/function.imap-alerts.php) functions, place this code before your imap\_close.

```
imap_errors();
imap_alerts();

```

What these functions do is return all errors and alerts that have occured and then flushes them. If you do not call these functions they are issued as notices when imap\_close() is called, or the page dies.
You can get all warnings and errors while suppressing notices using this:

```
error_reporting(E_ALL & ~E_NOTICE & ~E_USER_NOTICE);

```

The bit-level error reporting flags are:

```

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's possible that it was 
                    intentional (e.g., using an uninitialized variable and 
                    relying on the fact it's 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's initial startup
###############################################################################
E_CORE_WARNING      Warnings (non-fatal errors) that occur during PHP's 
                    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 doesn't flood your log as well.

```
ini_set('ignore_repeated_errors',1);

```