php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49445 Segfault on connection close
Submitted: 2009-09-02 22:16 UTC Modified: 2009-09-10 01:00 UTC
From: jake dot levitt at mailtrust dot com Assigned:
Status: No Feedback Package: IMAP related
PHP Version: 5.3.0 OS: CentOS 5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jake dot levitt at mailtrust dot com
New email:
PHP Version: OS:

 

 [2009-09-02 22:16 UTC] jake dot levitt at mailtrust dot com
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 = 'noteworthy2@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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-02 22:46 UTC] scottmac@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

Also what version of c-client are you using?
 [2009-09-10 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 12:01:33 2025 UTC