Edit report at http://bugs.php.net/bug.php?id=33039&edit=1
ID: 33039 Comment by: kiall at managedit dot ie Reported by: mpb dot mail at gmail dot com Summary: on shutdown: Notice: Unknown: Mailbox is empty (errflg=1) in Unknown on line 0 Status: Bogus Type: Bug Package: IMAP related Operating System: * PHP Version: 5.*, 4.* Assigned To: sniper Block user comment: N New Comment: In my opinion ... this is an issue. "Bug" maybe not, poor implementation? Most certainly. If imap_open() generates an error. imap_open() should raise an error. Script termination should only raise an error, if *script termination* raises an error. Really - This needs to be fixed. Previous Comments: ------------------------------------------------------------------------ [2007-07-30 12:21:49] t...@php.net I think the key point here is that imap_errors() should be called after doing the imap_open(), which would clear the error stack and stop PHP throwing E_NOTICEs. This isn't very clear in the manual, which is arguably a doc bug. ------------------------------------------------------------------------ [2005-05-19 15:38:41] il...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php On request termination PHP flushes all not yet reported IMAP errors at E_NOTICE error reporting level. The fact there are any is the result of the IMAP library reporting them. ------------------------------------------------------------------------ [2005-05-16 08:35:15] mpb dot mail at gmail dot com Description: ------------ If you imap_open an empty pop mailbox, a "Mailbox is empty (errflg=1)" notice will be printed during PHP's "shutdown" or "cleanup" phase after your script has finished running (assuming E_NOTICE is set, of course). As there is nothing wrong with having an empty mailbox, I believe that PHP should not print this notice. I suspect that PHP is misinterpreting a return code from the IMAP library, or is making an unnecessary call to the IMAP library. It is also possible that the IMAP library is buggy and should not be returning an errflg=1 (whatever that means). If, in the reproduce code, you uncomment the final ini_set then the notice will not be printed (as E_NOTICE is no longer set during PHP's shutdown). If you are unable to reproduce this problem with the empty POP mailbox of your choice, let me know and I will set up a POP mailbox for you to test against. See also bug 7207. Reproduce code: --------------- ini_set ('error_reporting', E_ALL); $imap = imap_open ( '{host.com:110/pop/novalidate-cert}INBOX', 'user', 'password' ); trigger_error ('test notice'); sleep (5); // ini_set ('error_reporting', E_ALL ^ E_NOTICE); Expected result: ---------------- Notice: test notice in /root/pinstall/local/vl0/test.php on line 8 Actual result: -------------- Notice: test notice in /root/pinstall/local/vl0/test.php on line 8 Notice: Unknown: Mailbox is empty (errflg=1) in Unknown on line 0 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=33039&edit=1