#39802 [Fbk->Opn]: PHP segfaults with odbc_connect()

From: Date: Mon, 11 Dec 2006 22:48:16 +0000
Subject: #39802 [Fbk->Opn]: PHP segfaults with odbc_connect()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-106218@lists.php.net to get a copy of this message
ID: 39802 User updated by: webmaster at guestwho dot com Reported By: webmaster at guestwho dot com -Status: Feedback +Status: Open Bug Type: ODBC related Operating System: FreeBSD 6.1-RELEASE PHP Version: 5.2.0 New Comment: Attempting building the latest CVS, which fails as follows: /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c: In function `zif_odbc_tableprivileges': /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3620: error: syntax error before "rc" /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3642: error: `rc' undeclared (first use in this function) /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3642: error: structure has no member named `hdbc' /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3642: error: structure has no member named `stmt' /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3643: error: `SQL_INVALID_HANDLE' undeclared (first use in this function) /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3649: error: `SQL_ERROR' undeclared (first use in this function) /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3650: error: `SQL_NULL_HSTMT' undeclared (first use in this function) /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3655: warning: implicit declaration of function `SQLTablePrivileges' /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3655: error: structure has no member named `stmt' /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3656: error: `SWORD' undeclared (first use in this function) /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3656: error: `SQL_NTS' undeclared (first use in this function) /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3666: error: structure has no member named `numparams' /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3667: error: structure has no member named `stmt' /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3667: error: structure has no member named `numcols' /usr/local/src/php5.2-200612112130/ext/odbc/php_odbc.c:3669: error: structure has no member named `numcols' *** Error code 1 Previous Comments: ------------------------------------------------------------------------ [2006-12-11 22:29:53] tony2001@php.net Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip ------------------------------------------------------------------------ [2006-12-11 22:26:06] webmaster at guestwho dot com Description: ------------ I have been trying to connect a microsoft access database using PHP, mdbtools and unixODBC, but any attempt at calling odbc_connect() results in an immediate segfault. This behaviour occurs in both the shared apache module and the standalone cgi version. Only the latter dumps core though. PHP is configured as follows: ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql \ --with-zlib --with-pdo-mysql=/usr/local/mysql --enable-mbstring \ --with-curl=/usr/local --enable-debug --with-openssl=/usr/local/ssl \ --with-gd --with-custom-odbc=/usr/local Here are the unixODBC configs: odbcinst.ini ------------- [MDBToolsODBC] Description = MDB Tools ODBC drivers Driver = /usr/local/lib/libmdbodbc.0 Setup = FileUsage = 1 CPTimeout = CPReuse = DisableGetFunctions = 0 UsageCount = 1 -------------- odbc.ini -------------- [Water] Description = Water Module Driver = MDBToolsODBC Trace = Yes TraceFile = /var/log/sql.log Database = /home/skeleton-man/public_html/water/water.mdb Servername = localhost UserName = Password = --------------- Reproduce code: --------------- <? $myDB = odbc_connect('Water','',''); $query = "SELECT RLCode FROM Account"; $result = odbc_exec($myDB, $query); while (odbc_fetch_row($result)){ print odbc_result($result,'RLCode')."<br>"; } ?> Expected result: ---------------- It should print a list of account numbers from the RLCode column in the database. Actual result: -------------- PHP segfaults immediately with no output. Backtrace: #0 0x082ef680 in zend_hash_find (ht=0x8829668, arKey=0x884137c "unixODBC_Water___2", nKeyLength=19, pData=0x10000) at /usr/local/src/php-5.2.0/Zend/zend_hash.c:849 #1 0x081a26ac in odbc_do_connect (ht=3, return_value=0x8841364, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1, persistent=0) at /usr/local/src/php-5.2.0/ext/odbc/php_odbc.c:2341 #2 0x081a1c13 in zif_odbc_connect (ht=3, return_value=0x8841364, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1) at /usr/local/src/php-5.2.0/ext/odbc/php_odbc.c:2053 #3 0x083008a6 in zend_do_fcall_common_helper_SPEC (execute_data=0xbfbfd510) at zend_vm_execute.h:200 #4 0x0830002d in execute (op_array=0x8840a84) at zend_vm_execute.h:92 #5 0x082e87c3 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/local/src/php-5.2.0/Zend/zend.c:1097 #6 0x082b1ee5 in php_execute_script (primary_file=0xbfbfec00) at /usr/local/src/php-5.2.0/main/main.c:1758 #7 0x083615ba in main (argc=2, argv=0xbfbfeca8) at /usr/local/src/php-5.2.0/sapi/cgi/cgi_main.c:1625 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39802&edit=1

« previous php.bugs (#106218) next »