From: jake dot levitt at mailtrust dot com Operating system: CentOS 5 PHP version: 5.3.0 PHP Bug Type: IMAP related Bug description: imap_reopen() returns TRUE instead FALSE called with nonexistant mailbox
Description: ------------ When calling imap_reopen() on a folder that doesn't exist, the function returns true instead of the expected result of false. It seems this was reported back in 2002 but marked as bogus (http://bugs.php.net/bug.php?id=15197). I have reproduced this bug in the most recent version of php. Reproduce code: --------------- <?php $flags = '/novalidate-cert'; $host = 'imap.server.example.com:143'; $username = 'test.u...@example.com'; $password = 'password'; $folder = 'INBOX'; $base_imap_string = '{' . $host . $flags . '}'; $connect_string = $base_imap_string . $folder; $mailbox = imap_open($connect_string, $username, $password, 0, 3); $connect_string = $base_imap_string . $folder . '.No such critter'; $reopen_success = imap_reopen($mailbox, $connect_string, 0, 3); $error_message = imap_last_error(); if (!$mailbox) { exit(0); } if ($reopen_success) { echo "Reopen SUCCEEDED and error message is: $error_message\n"; } else { echo "Reopen FAILED and error message is: $error_message\n"; } Expected result: ---------------- Output: Reopen FAILED and error message is: Mailbox doesn't exist: No such critter Actual result: -------------- Output: Reopen SUCCEEDED and error message is: Mailbox doesn't exist: No such critter -- Edit bug report at http://bugs.php.net/?id=49425&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49425&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49425&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49425&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49425&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49425&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49425&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49425&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49425&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49425&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49425&r=support Expected behavior: http://bugs.php.net/fix.php?id=49425&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49425&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49425&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49425&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49425&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49425&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49425&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49425&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49425&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49425&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49425&r=mysqlcfg