ID: 48619 Comment by: andy at webtatic dot com Reported By: andy at webtatic dot com Status: Feedback Bug Type: IMAP related Operating System: CentOS 5.3 i386 PHP Version: 5.2.10 Assigned To: pajoye New Comment:
Ok, I did some investigating and found out it is caused by the fix #47940. If no search flags are set, you set flags to SE_FREE, which mail_search_full then frees the pgm internally, but then you then free again, causing the segfault. This will be an issue on any OS. The correct way to do it would probably be to always add the SE_FREE flag and let it do it itself, and not free in imap_search. Previous Comments: ------------------------------------------------------------------------ [2009-06-20 20:10:17] paj...@php.net Hm, this version is outdated. Can you try using a decent version? 2007x (where x is a letter). You can get it here: http://www.washington.edu/imap/ ------------------------------------------------------------------------ [2009-06-20 18:01:58] andy at webtatic dot com I've done a simple build of php using the php-5.2.10.tar.gz from php.net, and it has the same issue. It still segfaults, and doesn't contain additional debug information: ./configure --enable-debug --with-imap --with-imap-ssl --with-kerberos --with-openssl --with-mysql gdb ./sapi/cli/php run myscript.php Program received signal SIGSEGV, Segmentation fault. 0x0012f3ff in mail_free_searchset () from /usr/lib/libc-client.so.1 (gdb) bt #0 0x0012f3ff in mail_free_searchset () from /usr/lib/libc-client.so.1 #1 0x0012f41b in mail_free_searchset () from /usr/lib/libc-client.so.1 #2 0x0012f41b in mail_free_searchset () from /usr/lib/libc-client.so.1 #3 0x0012f41b in mail_free_searchset () from /usr/lib/libc-client.so.1 #4 0x0012f41b in mail_free_searchset () from /usr/lib/libc-client.so.1 ------------------------------------------------------------------------ [2009-06-20 17:41:07] andy at webtatic dot com The c client I'm using is the one part of CentOS 5.3, 2004g-2.2.1 I added the --enable-debug to the configure earlier, and got a php build that had a version like: PHP 5.2.10 (cli) (built: Jun 20 2009 18:09:52) (DEBUG) I'm not sure why its not adding debug information. Sorry, the proper ./configure is more like: configure \ --cache-file=../config.cache \ --with-libdir=%{_lib} \ --with-config-file-path=%{_sysconfdir} \ --with-config-file-scan-dir=%{_sysconfdir}/php.d \ --with-pic \ --disable-rpath \ --without-pear \ --with-bz2 \ --with-curl \ --with-exec-dir=%{_bindir} \ --with-freetype-dir=%{_prefix} \ --with-png-dir=%{_prefix} \ --enable-gd-native-ttf \ --without-gdbm \ --with-gettext \ --with-gmp \ --with-iconv \ --with-jpeg-dir=%{_prefix} \ --with-openssl \ --with-png \ --with-pspell \ --with-expat-dir=%{_prefix} \ --with-pcre-regex=%{_prefix} \ --with-zlib \ --with-layout=GNU \ --enable-exif \ --enable-ftp \ --enable-magic-quotes \ --enable-sockets \ --enable-sysvsem --enable-sysvshm --enable-sysvmsg \ --enable-track-vars \ --enable-trans-sid \ --enable-yp \ --enable-wddx \ --with-kerberos \ --enable-ucd-snmp-hack \ --with-unixODBC=shared,%{_prefix} \ --enable-memory-limit \ --enable-shmop \ --enable-calendar \ --enable-dbx \ --enable-dio \ --without-mime-magic \ --without-sqlite \ --with-libxml-dir=%{_prefix} \ --with-xml \ --with-system-tzdata \ --enable-debug \ --enable-force-cgi-redirect \ --enable-pcntl \ --with-imap=shared --with-imap-ssl \ --enable-mbstring=shared --enable-mbstr-enc-trans \ --enable-mbregex \ --with-ncurses=shared \ --with-gd=shared \ --enable-bcmath=shared \ --enable-dba=shared --with-db4=%{_prefix} \ --with-xmlrpc=shared \ --with-ldap=shared --with-ldap-sasl \ --with-mysql=shared,%{_prefix} \ --with-mysqli=shared,%{_bindir}/mysql_config \ --enable-dom=shared \ --with-dom-xslt=%{_prefix} --with-dom-exslt=%{_prefix} \ --with-pgsql=shared \ --with-snmp=shared,%{_prefix} \ --enable-soap=shared \ --with-xsl=shared,%{_prefix} \ --enable-xmlreader=shared --enable-xmlwriter=shared \ --enable-fastcgi \ --enable-pdo=shared \ --with-pdo-odbc=shared,unixODBC,%{_prefix} \ --with-pdo-mysql=shared,%{_prefix} \ --with-pdo-pgsql=shared,%{_prefix} \ --with-pdo-sqlite=shared,%{_prefix} \ --enable-json=shared \ --enable-zip=shared \ --with-readline \ --enable-dbase=shared ------------------------------------------------------------------------ [2009-06-20 16:56:44] paj...@php.net Please compile in debug mode (--enable-debug) and provide again the backtrace. Which c-client version do you use? ------------------------------------------------------------------------ [2009-06-20 16:44:02] andy at webtatic dot com Description: ------------ imap_search($connection, 'ALL') seems to be causing a segmentation fault. The backtrace (from what I guess), seems to suggest the command is recursively calling itself to free the searchset, the same thing being called endlessly. The php build was based on the CentOS testing php-5.2.6 rpm modified to compile php-5.2.10. php-5.2.9 did not have this issue. build --enable-force-cgi-redirect \ --enable-pcntl \ --with-imap=shared --with-imap-ssl \ --enable-mbstring=shared --enable-mbstr-enc-trans \ --enable-mbregex \ --with-ncurses=shared \ --with-gd=shared \ --enable-bcmath=shared \ --enable-dba=shared --with-db4=%{_prefix} \ --with-xmlrpc=shared \ --with-ldap=shared --with-ldap-sasl \ --with-mysql=shared,%{_prefix} \ --with-mysqli=shared,%{_bindir}/mysql_config \ --enable-dom=shared \ --with-dom-xslt=%{_prefix} --with-dom-exslt=%{_prefix} \ --with-pgsql=shared \ --with-snmp=shared,%{_prefix} \ --enable-soap=shared \ --with-xsl=shared,%{_prefix} \ --enable-xmlreader=shared --enable-xmlwriter=shared \ --enable-fastcgi \ --enable-pdo=shared \ --with-pdo-odbc=shared,unixODBC,%{_prefix} \ --with-pdo-mysql=shared,%{_prefix} \ --with-pdo-pgsql=shared,%{_prefix} \ --with-pdo-sqlite=shared,%{_prefix} \ --enable-json=shared \ --enable-zip=shared \ --with-readline \ --enable-dbase=shared \ --enable-debug Actual result: -------------- #0 0x020393ff in mail_free_searchset () from /usr/lib/libc-client.so.1 #1 0x0203941b in mail_free_searchset () from /usr/lib/libc-client.so.1 #2 0x0203941b in mail_free_searchset () from /usr/lib/libc-client.so.1 #3 0x0203941b in mail_free_searchset () from /usr/lib/libc-client.so.1 #4 0x0203941b in mail_free_searchset () from /usr/lib/libc-client.so.1 #5 0x0203941b in mail_free_searchset () from /usr/lib/libc-client.so.1 #6 0x0203941b in mail_free_searchset () from /usr/lib/libc-client.so.1 #7 0x0203941b in mail_free_searchset () from /usr/lib/libc-client.so.1 #8 0x0203941b in mail_free_searchset () from /usr/lib/libc-client.so.1 #9 0x0203941b in mail_free_searchset () from /usr/lib/libc-client.so.1 #10 0x0203941b in mail_free_searchset () from /usr/lib/libc-client.so.1 ... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48619&edit=1