|
|
af9dc8 |
From 657494235eafe048e9fa6a19dcdb3c73a0cbe6ec Mon Sep 17 00:00:00 2001
|
|
|
af9dc8 |
From: Remi Collet <fedora@famillecollet.com>
|
|
|
af9dc8 |
Date: Thu, 27 Sep 2012 13:45:32 +0200
|
|
|
af9dc8 |
Subject: [PATCH] Fixed bug #63171, script hangs if odbc call during timeout
|
|
|
af9dc8 |
|
|
|
af9dc8 |
---
|
|
|
af9dc8 |
ext/odbc/php_odbc.c | 21 ++++++++++++++-------
|
|
|
af9dc8 |
1 file changed, 14 insertions(+), 7 deletions(-)
|
|
|
af9dc8 |
|
|
|
af9dc8 |
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
|
|
|
af9dc8 |
index 52d46b2..2169e65 100644
|
|
|
af9dc8 |
--- a/ext/odbc/php_odbc.c
|
|
|
af9dc8 |
+++ b/ext/odbc/php_odbc.c
|
|
|
af9dc8 |
@@ -431,7 +431,8 @@ static void _free_odbc_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
|
|
af9dc8 |
efree(res->values);
|
|
|
af9dc8 |
res->values = NULL;
|
|
|
af9dc8 |
}
|
|
|
af9dc8 |
- if (res->stmt) {
|
|
|
af9dc8 |
+ /* If aborted via timer expiration, don't try to call any unixODBC function */
|
|
|
af9dc8 |
+ if (res->stmt && !(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) {
|
|
|
af9dc8 |
#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35)
|
|
|
af9dc8 |
SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc,
|
|
|
af9dc8 |
(SQLUSMALLINT) SQL_COMMIT);
|
|
|
af9dc8 |
@@ -484,9 +485,12 @@ static void _close_odbc_conn(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
|
|
af9dc8 |
}
|
|
|
af9dc8 |
}
|
|
|
af9dc8 |
|
|
|
af9dc8 |
- safe_odbc_disconnect(conn->hdbc);
|
|
|
af9dc8 |
- SQLFreeConnect(conn->hdbc);
|
|
|
af9dc8 |
- SQLFreeEnv(conn->henv);
|
|
|
af9dc8 |
+ /* If aborted via timer expiration, don't try to call any unixODBC function */
|
|
|
af9dc8 |
+ if (!(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) {
|
|
|
af9dc8 |
+ safe_odbc_disconnect(conn->hdbc);
|
|
|
af9dc8 |
+ SQLFreeConnect(conn->hdbc);
|
|
|
af9dc8 |
+ SQLFreeEnv(conn->henv);
|
|
|
af9dc8 |
+ }
|
|
|
af9dc8 |
efree(conn);
|
|
|
af9dc8 |
ODBCG(num_links)--;
|
|
|
af9dc8 |
}
|
|
|
af9dc8 |
@@ -512,9 +516,12 @@ static void _close_odbc_pconn(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
|
|
af9dc8 |
}
|
|
|
af9dc8 |
}
|
|
|
af9dc8 |
|
|
|
af9dc8 |
- safe_odbc_disconnect(conn->hdbc);
|
|
|
af9dc8 |
- SQLFreeConnect(conn->hdbc);
|
|
|
af9dc8 |
- SQLFreeEnv(conn->henv);
|
|
|
af9dc8 |
+ /* If aborted via timer expiration, don't try to call any unixODBC function */
|
|
|
af9dc8 |
+ if (!(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) {
|
|
|
af9dc8 |
+ safe_odbc_disconnect(conn->hdbc);
|
|
|
af9dc8 |
+ SQLFreeConnect(conn->hdbc);
|
|
|
af9dc8 |
+ SQLFreeEnv(conn->henv);
|
|
|
af9dc8 |
+ }
|
|
|
af9dc8 |
free(conn);
|
|
|
af9dc8 |
|
|
|
af9dc8 |
ODBCG(num_links)--;
|
|
|
af9dc8 |
--
|
|
|
af9dc8 |
1.7.10
|
|
|
af9dc8 |
|