php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39875 imap_open causes a segmentation fault
Submitted: 2006-12-18 20:48 UTC Modified: 2006-12-19 19:44 UTC
From: richard at hddbroker dot com Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 5.2.0 OS: CentOS 4.4 i386
Private report: No CVE-ID: None
 [2006-12-18 20:48 UTC] richard at hddbroker dot com
Description:
------------
I was trying to get a simple script to work which simply opened a connection to the mail server and then closed it but when I ran the script it caused a segmentation fault on the imap_open line.

Reproduce code:
---------------
<?php
  $mailbox = '{mail.hddbroker.com:143}INBOX';
  $username = 'xxx';
  $password = 'yyy';

  $mbox = imap_open($mailbox, $username, $password);
  imap_close($mbox);
?>

If I run the script via the CLI version of PHP it prints "Segmentation fault (core dumped)".  If I run the script via a web server, an empty page is returned.

Expected result:
----------------
In this particular script I expected the imap_open function to return a resource object.

Actual result:
--------------
I configured my PHP with --enable-debug and followed the steps to get the following backtrace:

#0  0x00144019 in SSL_SESSION_hash () from /lib/libssl.so.4
#1  0x001ca484 in lh_free () from /lib/libcrypto.so.4
#2  0x001ca5f3 in lh_delete () from /lib/libcrypto.so.4
#3  0x00148141 in SSL_CTX_get_timeout () from /lib/libssl.so.4
#4  0x001ca56e in lh_retrieve () from /lib/libcrypto.so.4
#5  0x001481f7 in SSL_CTX_flush_sessions () from /lib/libssl.so.4
#6  0x001441a3 in SSL_CTX_free () from /lib/libssl.so.4
#7  0x005185ac in ssl_close () from /usr/lib/libc-client.so.0
#8  0x0051851f in ssl_close () from /usr/lib/libc-client.so.0
#9  0x005176c3 in ssl_aopen () from /usr/lib/libc-client.so.0
#10 0x0054a697 in imap_open () from /usr/lib/libc-client.so.0
#11 0x00523a90 in mail_open () from /usr/lib/libc-client.so.0
#12 0x0814dcfc in zif_imap_open (ht=3, return_value=0xb7c8bc9c, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
    at /usr/local/src/php-5.2.0/ext/imap/php_imap.c:780
#13 0x08332c92 in zend_do_fcall_common_helper_SPEC (execute_data=0xbfe372e0) at /usr/local/src/php-5.2.0/Zend/zend_vm_execute.h:200
#14 0x08332419 in execute (op_array=0xb7c8b68c) at /usr/local/src/php-5.2.0/Zend/zend_vm_execute.h:92
#15 0x0831aa9b in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/local/src/php-5.2.0/Zend/zend.c:1097
#16 0x082e4a51 in php_execute_script (primary_file=0xbfe397d0) at /usr/local/src/php-5.2.0/main/main.c:1758
#17 0x08393462 in main (argc=2, argv=0xbfe398a4) at /usr/local/src/php-5.2.0/sapi/cli/php_cli.c:1108

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-19 08:59 UTC] tony2001@php.net
What was your configure line? Did you enable mysql? If yes, which version of MySQL do you have installed?
 [2006-12-19 15:17 UTC] richard at hddbroker dot com
The configure command I used is:

./configure
--with-apxs2=/usr/local/apache2/bin/apxs
--with-mysql
--enable-so
--enable-exif
--with-gd
--with-zlib
--with-jpeg
--with-png
--enable-gd-native-ttf
--enable-wddx
--with-curl
--with-mysqli
--with-pear
--enable-mbstring
--enable-shmop
--enable-soap
--enable-calendar
--with-openssl
--with-xmlrpc
--enable-sockets
--with-imap
--with-kerberos
--with-imap-ssl
--enable-debug

I have the following RPMs installed for MySQL:

MySQL-client-standard-5.0.27-0.rhel4
MySQL-devel-standard-5.0.27-0.rhel4

The actual MySQL server is on another machine.
 [2006-12-19 15:19 UTC] tony2001@php.net
Please remove --with-mysql and --with-mysqli, rebuild PHP and try again (--enable-so also can be removed, there is no such PHP configure option anyway).
 [2006-12-19 15:36 UTC] richard at hddbroker dot com
When I removed those three options from the configure statement and then re-compiled PHP, it corrected the problem.  So what does this mean in terms of using MySQL with the IMAP functions?
 [2006-12-19 15:37 UTC] iliaa@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

it means there is a conflict, probably has to do with mysql 
being built against different ssl lib with conflicting symbols 
to those used by imap.
 [2006-12-19 19:44 UTC] tony2001@php.net
MySQL guys said the conflict between OpenSSL and YaSSL (used in MySQL binary builds) should be fixed in MySQL 5.0.32 and 5.1.15.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC