From:             tho at e-dict dot net
Operating system: Linux
PHP version:      4.3.8
PHP Bug Type:     ODBC related
Bug description:  segmentation fault when script finished

Description:
------------
Some of our database scripts produce segfaults when they are done. It is
difficult to supply sample code since the segfault depends at least on the
following:

* a successful call to odbc_pconnect('host:node','user', 'pass'); 

if odbc_pconnect fails there is no segfault

* some (included?) code before odbc_pconnect

While trying to reduce the code i noticed, that include(_once?) is needed
to trigger the problem. That's meant with "some _included_ code" in the
sample below.

* filename

"/var/home/tho/oss/sbwi/bin/php -c /var/home/tho/oss/sbwi/conf -f
/var/home/tho/oss/sbwi/dump1.php"
cores while the similar code in
"/var/home/tho/oss/sbwi/bin/php -c /var/home/tho/oss/sbwi/conf -f
/var/home/tho/oss/sbwi/dump.php"
does not core

The code itself works fine. The segfault always happens after the last
line.

We are connecting to ADABAS using ODBC

configure:

./configure\
         --prefix=$(PREFIX)\
         --with-adabas=$(adabas_dir)\
         --with-openssl=$(PREFIX) \
         --disable-session\
         --with-db\
         --without-gd\
         --with-config-file-path=$(PREFIX)/conf


Reproduce code:
---------------
<?
[...some _included_ code...]
$dbhandle = @odbc_pconnect('host:node','user', 'pass');
exit;
?>

Expected result:
----------------
no segfault :-)

Actual result:
--------------
(gdb) run -c /var/home/tho/oss/sbwi/conf -f
/var/home/tho/oss/sbwi/dump1.php
Starting program: /var/home/tho/oss/sbwi/bin/php -c
/var/home/tho/oss/sbwi/conf -f /var/home/tho/oss/sbwi/dump1.php

Program received signal SIGSEGV, Segmentation fault.
zend_hash_index_find (ht=0x82cece0, h=7, pData=0xbffff3f8) at
/var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_hash.c:967
967                     if ((p->h == h) && (p->nKeyLength == 0)) {
(gdb) bt
#0  zend_hash_index_find (ht=0x82cece0, h=7, pData=0xbffff3f8) at
/var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_hash.c:967
#1  0x081518af in _zend_list_find (id=7, type=0xbffff428) at
/var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_list.c:70
#2  0x080a212d in _close_odbc_pconn (rsrc=0x83071a0) at
/var/home/tho/oss/sbwi/src/software/php-4.3.8/ext/odbc/php_odbc.c:250
#3  0x08151b1e in plist_entry_destructor (ptr=0x83071a0) at
/var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_list.c:203
#4  0x0815091a in zend_hash_apply_deleter (ht=0x82ced08, p=0x8323cb0) at
/var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_hash.c:611
#5  0x08150a5b in zend_hash_graceful_reverse_destroy (ht=0x82ced08) at
/var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_hash.c:677
#6  0x08151bc2 in zend_destroy_rsrc_list (ht=0x82ced08) at
/var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_list.c:233
#7  0x0814bfb3 in zend_shutdown () at
/var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend.c:554
#8  0x081262fe in php_module_shutdown () at
/var/home/tho/oss/sbwi/src/software/php-4.3.8/main/main.c:1286
#9  0x08164319 in main (argc=5, argv=0xbffff694) at
/var/home/tho/oss/sbwi/src/software/php-4.3.8/sapi/cgi/cgi_main.c:1685
#10 0x401027ee in __libc_start_main () from /lib/libc.so.6


-- 
Edit bug report at http://bugs.php.net/?id=30052&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30052&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30052&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30052&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30052&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30052&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30052&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30052&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30052&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30052&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30052&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30052&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30052&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30052&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30052&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30052&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30052&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30052&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30052&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30052&r=mysqlcfg

Reply via email to