Bug 156570

Summary: lang/php5 segfaults when invoked on the command line after update to databases/sqlite3
Product: Ports & Packages Reporter: AimelyneM <aimelynem>
Component: Individual Port(s)Assignee: Alex Dupre <ale>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description AimelyneM 2011-04-22 12:00:17 UTC
Following an update to databases/sqlite3 (3.7.5 to 3.7.6.1), lang/php5 always segfaults ('Segmentation fault: 11') on exit when invoked on the command line, whether in interactive (php -a) or non-interactive mode.

Both pdo_sqlite and sqlite3 are installed as extensions.

A similar setup on Arch Linux doesn't result in the same issue, which may indicate the problem is related to FreeBSD.

backtrace of the core dump produced by running php -m:

(gdb) bt
#0  0x28dde100 in ?? ()
#1  0x286e37d4 in pthread_mutex_destroy () from /lib/libc.so.7
#2  0x284701a8 in xmlFreeMutex () from /usr/local/lib/libxml2.so.5
#3  0x2846fa24 in xmlCleanupGlobals () from /usr/local/lib/libxml2.so.5
#4  0x28401b1a in xmlCleanupParser () from /usr/local/lib/libxml2.so.5
#5  0x0809406b in php_libxml_shutdown ()
#6  0x0809409b in zm_shutdown_libxml ()
#7  0x081a11ee in module_destructor ()
#8  0x081a8224 in zend_hash_apply_deleter ()
#9  0x081a8468 in zend_hash_graceful_reverse_destroy ()
#10 0x0819cb5e in zend_shutdown ()
#11 0x08149aaa in php_module_shutdown ()
#12 0x0821fe7d in main ()
#13 0x28805080 in ?? ()
#14 0x0821eea0 in sapi_cli_send_header ()
#15 0x0805b307 in _start1 ()
#16 0x0805b278 in _start ()
#17 0x282c7d50 in dlclose () from /libexec/ld-elf.so.1
#18 0x00000002 in ?? ()
(gdb) 

Last lines of the backtrace of the core dump produced by running php -a (readline compiled-in), then exiting immediately:

#55 0x282c58fc in _rtld_error () from /libexec/ld-elf.so.1
#56 0x0805b307 in _start1 ()
#57 0x0805b278 in _start ()
#58 0x282c7d50 in dlclose () from /libexec/ld-elf.so.1
#59 0x00000002 in ?? ()

Fix: 

Unsatisfactory workaround: comment out both sqlite3 and pdo_sqlite in /usr/local/etc/php/extensions.ini
How-To-Repeat: With pdo_sqlite and sqlite3 installed and configured to be loaded on PHP startup in /usr/local/etc/php/extensions.ini, run PHP on the command line;

eg:
php -m
php <filename>
php -r <code>

etc.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-04-22 12:00:35 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ale

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Alex Dupre freebsd_committer freebsd_triage 2011-04-22 12:25:55 UTC
State Changed
From-To: open->closed

Build php with LINKTHR option.