diff options
author | Remi Collet <remi@php.net> | 2016-03-17 13:38:45 +0100 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2016-03-17 13:38:45 +0100 |
commit | 407ad28ae5bbdf1c9e4c3ae8fa40a3ec6aeaf34e (patch) | |
tree | 73205088de26da99373f8006214e4d0879eea785 /ext/odbc | |
parent | 6d4aec029a06140eac8f57e8b3daa06aee43e145 (diff) | |
download | php-git-407ad28ae5bbdf1c9e4c3ae8fa40a3ec6aeaf34e.tar.gz |
Fix Bug #63171 Script hangs after max_execution_time
If aborted via timer expiration, don't try to call any unixODBC function
which may hangs because of internal locks
Diffstat (limited to 'ext/odbc')
-rw-r--r-- | ext/odbc/php_odbc.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index bde6c1ed14..0cd713598c 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -431,7 +431,8 @@ static void _free_odbc_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) efree(res->values); res->values = NULL; } - if (res->stmt) { + /* If aborted via timer expiration, don't try to call any unixODBC function */ + if (res->stmt && !(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { #if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35) SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc, (SQLUSMALLINT) SQL_COMMIT); @@ -487,9 +488,12 @@ static void _close_odbc_conn(zend_rsrc_list_entry *rsrc TSRMLS_DC) } } - safe_odbc_disconnect(conn->hdbc); - SQLFreeConnect(conn->hdbc); - SQLFreeEnv(conn->henv); + /* If aborted via timer expiration, don't try to call any unixODBC function */ + if (!(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { + safe_odbc_disconnect(conn->hdbc); + SQLFreeConnect(conn->hdbc); + SQLFreeEnv(conn->henv); + } efree(conn); ODBCG(num_links)--; } @@ -515,9 +519,12 @@ static void _close_odbc_pconn(zend_rsrc_list_entry *rsrc TSRMLS_DC) } } - safe_odbc_disconnect(conn->hdbc); - SQLFreeConnect(conn->hdbc); - SQLFreeEnv(conn->henv); + /* If aborted via timer expiration, don't try to call any unixODBC function */ + if (!(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { + safe_odbc_disconnect(conn->hdbc); + SQLFreeConnect(conn->hdbc); + SQLFreeEnv(conn->henv); + } free(conn); ODBCG(num_links)--; |