From:             jake dot levitt at mailtrust dot com
Operating system: CentOS 5
PHP version:      5.3.0
PHP Bug Type:     IMAP related
Bug description:  Segfault on connection close

Description:
------------
If an IMAP server closes a connection without sending a BYE command, PHP
segfaults on the next IMAP command run on the mailbox resource.  I noticed
this while testing against an exchange server, where I was selecting a
folder that doesn't exist.  After 10 times it disconnected me without
sending a BYE command.  When this happens PHP segfaulted, which doesn't
allow for the script to do any error handling.

Reproduce code:
---------------
<?php
//Try testing against an exchange server that disconnects after a
//certain number of "bad" commands
$flags = '/novalidate-cert';
$host = 'secure.emailsrvr.com:143';
$username = 'notewort...@sts.com';
$password = 'webmail';
$base_imap_string = '{' . $host . $flags . '}';
$connect_string = $base_imap_string . 'INBOX';
$mailbox = imap_open($connect_string, $username, $password, 0, 3);
$connect_string = $base_imap_string . 'Does not exist';
for ($i = 0; $i < 10; $i++) {
    $reopen_success = imap_reopen($mailbox, $connect_string, 0, 3);
}

Expected result:
----------------
imap_reopen either returns false or throws a PHP error.

Actual result:
--------------
The script segfaults.

-- 
Edit bug report at http://bugs.php.net/?id=49445&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49445&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49445&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49445&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49445&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49445&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49445&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49445&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49445&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49445&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49445&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49445&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49445&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49445&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49445&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49445&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49445&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49445&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49445&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49445&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49445&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49445&r=mysqlcfg

Reply via email to