|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39726 segmentation fault in imap_open
Submitted: 2006-12-04 10:41 UTC Modified: 2006-12-12 01:00 UTC
Avg. Score:4.7 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rommer at active dot by Assigned:
Status: No Feedback Package: IMAP related
PHP Version: 4.4.4 OS: Centos-3 x86
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-12-04 10:41 UTC] rommer at active dot by
Segmentation fault in function imap_open if script opens
~ 4000 files before.
I have increased __FD_SETSIZE in
to 262144 before compiling php (4.4.4, 5.1.6, 4.4.5-dev)

Reproduce code:
    $basedir = "/tmp/php_testcase";                                                                             
    if (! file_exists ($basedir)) {                                                                             
        mkdir ($basedir, 0700);                                                                                 
    $fds = array();                                                                                             
    for ($i = 0; $i < 4096; $i++) {                                                                             
        $fds[] = fopen ($basedir . '/file_' . $i, 'w');                                                         
    imap_open ('{}INBOX',                                                               
               '', 'test', 64);                                                                    

Expected result:
no segfault

Actual result:
Segmentation fault.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-04 10:50 UTC]
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 for *NIX and 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.

 [2006-12-04 14:17 UTC] rommer at active dot by
This is backtrace (php with --enable-debug, non-stripped)

(gdb) run -X
Starting program: /usr/local/apache-clean/bin/httpd -X
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 3248)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 3248)]
0x404e8e64 in ?? () from /usr/local/apache-clean/modules/
(gdb) bt
#0  0x404e8e64 in ?? () from /usr/local/apache-clean/modules/
#1  0x00001011 in ?? ()
#2  0x00000000 in ?? ()
 [2006-12-04 14:23 UTC]
>I have increased __FD_SETSIZE in <..skip..>to 262144 before compiling php
You should have done this before compiling c-client, as imap_open() is just a wrapper for c-client functions.

Please make sure you've configured PHP with --enabled-debug and regenerate the backtrace.
 [2006-12-12 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".
 [2008-12-16 14:51 UTC] michel at webawere dot com

I have this simmular problem. In tried it on centos linux 5.2 with apache and php 5.2.5. AND php 5.2.8

This command will get me an empty webpage and a line about segmentation fault in errorlog.
$mbox = imap_open($mailbox, $user, $passwd);

In errorlog:
[notice] child pid 14851 exit signal Segmentation fault (11)

Is there a work-around ?
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Mar 07 07:01:23 2021 UTC