Re: Bug #4075: Segmentation violation in init code.
| From: | Walter Franzini | Date: | Tue, 11 Apr 2000 10:48:34 +0000 |
| Subject: | Re: Bug #4075: Segmentation violation in init code. | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-17798@lists.php.net to get a copy of this message | ||
comitale@ca.ibm.com writes:
> From: comitale@ca.ibm.com
> Operating system: Redhat Linux 6.1
> PHP version: 3.0.16
> PHP Bug Type: Reproduceable crash
> Bug description: Segmentation violation in init code.
>
> My apologies, this is a dupliate of bug report #3861, but I see no mechanism to add more
> information to an existing bug report. I have a LOT of new information to provide regarding this
> problem, including how to duplicate it easily.
>
I think gnus has made some strange things with my previous message :)
try:
./configure --with-apxs=... --with-config-file-path=...
WITHOUT --with-ibm-db2
make
Apply the patch attached
cd php-3.0.1x
patch functions/unified_odbc.c unified_odbc.diff
Note: the patch is not specific to db2, but
you need it if you want to use odbc_prepare.
Now compile functions/unified_odbc.c as a php extension
perl -pi -e 's/HAVE_IBMDB2 0/HAVE_IBMDB2 1/g' config.h
perl -pi -e 's/HAVE_UODBC 0/HAVE_UODBC 1/g' config.h
gcc -shared -fPIC -DCOMPILE_DL=1 -I. -I/usr/include/apache \
-I/home/db2inst1/sqllib/include -o ibmdb2.so \
./functions/unified_odbc.c -L/home/db2inst1/sqllib/lib \
-Wl,-rpath /home/db2inst1/sqllib/lib -ldb2
Install libphp3.so and ibmdb2.so
Add the following line to php3
extension=ibmdb2.so
and restart apache.
--
Ciao Walter
*** functions/unified_odbc.c.orig Wed Apr 5 13:11:44 2000
--- functions/unified_odbc.c Wed Apr 5 13:12:14 2000
***************
*** 666,672 ****
}
#endif
! if ((rc = SQLPrepare(result->stmt, query, SQL_NTS)) != SQL_SUCCESS){
UODBC_SQL_ERROR(curr_conn->hdbc, result->stmt, "SQLPrepare");
SQLFreeStmt(result->stmt, SQL_DROP);
RETURN_FALSE;
--- 666,680 ----
}
#endif
! rc = SQLPrepare(result->stmt, query, SQL_NTS);
! switch (rc) {
! case SQL_SUCCESS:
! break;
! case SQL_SUCCESS_WITH_INFO:
! UODBC_SQL_ERROR(curr_conn->hdbc, result->stmt, "SQLPrepare");
! break;
!
! default:
UODBC_SQL_ERROR(curr_conn->hdbc, result->stmt, "SQLPrepare");
SQLFreeStmt(result->stmt, SQL_DROP);
RETURN_FALSE;
***************
*** 840,847 ****
}
}
} else {
! if (rc != SQL_SUCCESS){
! UODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SQLExecute");
RETVAL_FALSE;
}
}
--- 848,863 ----
}
}
} else {
! switch (rc) {
! case SQL_SUCCESS:
! break;
! case SQL_SUCCESS_WITH_INFO:
! UODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt,
! "SQLExecute");
! break;
! default:
! UODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt,
! "SQLExecute");
RETVAL_FALSE;
}
}
***************
*** 857,863 ****
efree(params);
}
! if (rc == SQL_SUCCESS){
RETVAL_TRUE;
}
--- 873,879 ----
efree(params);
}
! if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO){
RETVAL_TRUE;
}
***************
*** 903,909 ****
}
rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN,
(void *)&max_len,0,&len);
! if (rc != SQL_SUCCESS){
RETURN_FALSE;
}
--- 919,925 ----
}
rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN,
(void *)&max_len,0,&len);
! if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
RETURN_FALSE;
}
***************
*** 914,920 ****
RETURN_FALSE;
}
rc = SQLGetCursorName(result->stmt,cursorname,(SWORD)max_len,&len);
! if (rc != SQL_SUCCESS){
char state[6]; /* Not used */
SDWORD error; /* Not used */
char errormsg[255];
--- 930,936 ----
RETURN_FALSE;
}
rc = SQLGetCursorName(result->stmt,cursorname,(SWORD)max_len,&len);
! if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
char state[6]; /* Not used */
SDWORD error; /* Not used */
char errormsg[255];
***************
*** 926,934 ****
sizeof(errormsg)-1, &errormsgsize);
if (!strncmp(state,"S1015",5)){
sprintf(cursorname,"php3_curs_%d", (int)result->stmt);
! if (SQLSetCursorName(result->stmt,cursorname,SQL_NTS) != SQL_SUCCESS){
UODBC_SQL_ERROR(result->conn_ptr->hdbc,result->stmt,
! "SQLSetCursorName");
RETVAL_FALSE;
} else {
RETVAL_STRING(cursorname,1);
--- 942,951 ----
sizeof(errormsg)-1, &errormsgsize);
if (!strncmp(state,"S1015",5)){
sprintf(cursorname,"php3_curs_%d", (int)result->stmt);
! rc = SQLSetCursorName(result->stmt,cursorname,SQL_NTS);
! if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
UODBC_SQL_ERROR(result->conn_ptr->hdbc,result->stmt,
! "SQLSetCursorName");
RETVAL_FALSE;
} else {
RETVAL_STRING(cursorname,1);
***************
*** 1461,1467 ****
PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 :
result->values[field_ind].vallen);
! if (rc == SQL_SUCCESS) { /* no more data avail */
efree(field);
RETURN_TRUE;
}
--- 1478,1485 ----
PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 :
result->values[field_ind].vallen);
! if (rc == SQL_SUCCESS
! || rc == SQL_SUCCESS_WITH_INFO) { /* no more data avail */
efree(field);
RETURN_TRUE;
}
***************
*** 1779,1785 ****
#else
if(cur_opt != SQL_CUR_DEFAULT){
rc = SQLSetConnectOption(db_conn->hdbc, SQL_ODBC_CURSORS, cur_opt);
! if (rc != SQL_SUCCESS ) { /* && rc != SQL_SUCCESS_WITH_INFO ? */
UODBC_SQL_ERROR(db_conn->hdbc, SQL_NULL_HSTMT, "SQLSetConnectOption");
SQLFreeConnect(db_conn->hdbc);
if (persistent)
--- 1797,1804 ----
#else
if(cur_opt != SQL_CUR_DEFAULT){
rc = SQLSetConnectOption(db_conn->hdbc, SQL_ODBC_CURSORS, cur_opt);
! if (rc != SQL_SUCCESS
! && rc != SQL_SUCCESS_WITH_INFO) { /* && rc !=
SQL_SUCCESS_WITH_INFO ? */
UODBC_SQL_ERROR(db_conn->hdbc, SQL_NULL_HSTMT, "SQLSetConnectOption");
SQLFreeConnect(db_conn->hdbc);
if (persistent)
***************
*** 2189,2195 ****
rc = SQLGetConnectOption(curr_conn->hdbc, SQL_AUTOCOMMIT, (PTR)&status);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
! UODBC_SQL_ERROR(curr_conn->hdbc, SQL_NULL_HSTMT, "Test autocommit");
RETURN_FALSE;
}
RETVAL_LONG((long)status);
--- 2208,2215 ----
rc = SQLGetConnectOption(curr_conn->hdbc, SQL_AUTOCOMMIT, (PTR)&status);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
! UODBC_SQL_ERROR(curr_conn->hdbc, SQL_NULL_HSTMT,
! "Test autocommit");
RETURN_FALSE;
}
RETVAL_LONG((long)status);