php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10710 unsufficient checking of odbc persistent connection validity
Submitted: 2001-05-07 12:15 UTC Modified: 2001-06-08 17:30 UTC
From: pete at shadow dot ana dot sk Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.5 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pete at shadow dot ana dot sk
New email:
PHP Version: OS:

 

 [2001-05-07 12:15 UTC] pete at shadow dot ana dot sk
I'm using sybase adaptive server anywhere on linux as sql server and it disconnects clients after some client idle time. There is a check for persistent connection validity, but it does not work. if uses
SQLGetInfo(..., SQL_DATA_SOURCE_READ_ONLY, ...
but that does not verify the connnection, it returns ok everytime. Only few SQLGetInfo info types are connecting to server, like SQL_SERVER_NAME for example. I think this is server specific, so it would be good to have it as configurable parameter. Also, SQLGetInfo does not return error code if connection is not alive anymore, if only returns empty info data, so that should be checked too.

I made a small patch for my php to have it so, here it is (maybe it helps)
diff -urN php-4.0.5/ext/odbc/php_odbc.c php/ext/odbc/php_odbc.c
--- php-4.0.5/ext/odbc/php_odbc.c       Sat Mar 10 00:44:55 2001
+++ php/ext/odbc/php_odbc.c     Mon May  7 17:40:11 2001
@@ -309,6 +309,8 @@
                        defaultbinmode, php_odbc_globals, odbc_globals, display_
binmode)
        STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpda
teInt,
                check_persistent, php_odbc_globals, odbc_globals)
+       STD_PHP_INI_ENTRY("odbc.check_persistent_info_type", "25", PHP_INI_SYSTE
M, OnUpdateInt,
+               check_persistent_info_type, php_odbc_globals, odbc_globals)
 PHP_INI_END()
 
 #ifdef ZTS
@@ -2087,10 +2089,10 @@
                                SWORD len;
 
                                ret = SQLGetInfo(db_conn->hdbc, 
-                                       SQL_DATA_SOURCE_READ_ONLY, 
+                                       ODBCG(check_persistent_info_type),
                                        d_name, sizeof(d_name), &len);
 
-                               if(ret != SQL_SUCCESS){
+                               if(ret != SQL_SUCCESS || len == 0){
                                        zend_hash_del(&EG(persistent_list), hash
ed_details, hashed_len + 1);
                                        SQLDisconnect(db_conn->hdbc);
                                        SQLFreeConnect(db_conn->hdbc);
diff -urN php-4.0.5/ext/odbc/php_odbc.h php/ext/odbc/php_odbc.h
--- php-4.0.5/ext/odbc/php_odbc.h       Sat Mar 10 00:44:55 2001
+++ php/ext/odbc/php_odbc.h     Mon May  7 17:33:14 2001
@@ -283,6 +283,7 @@
        char *defPW;
        long allow_persistent;
        long check_persistent;
+       long check_persistent_info_type;
        long max_persistent;
        long max_links;
        long num_persistent;

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-08 17:30 UTC] kalowsky@php.net
placed in cvs, thanks for the help!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 22:01:29 2024 UTC