]> granicus.if.org Git - php/commitdiff
MFH: fix PECL bug #9061 (oci8 might reuse wrong persistent connection)
authorAntony Dovgal <tony2001@php.net>
Wed, 18 Oct 2006 14:23:23 +0000 (14:23 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 18 Oct 2006 14:23:23 +0000 (14:23 +0000)
NEWS
ext/oci8/oci8.c

diff --git a/NEWS b/NEWS
index c52076b0e6e8dacc43d98e4470ace4d1f1b7000e..d5f0414aafcb849b4477563c10413552ce2957cc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ PHP                                                                        NEWS
 - Fixed bug #39020 (PHP in FastCGI server mode crashes). (Dmitry)
 - Fixed bug #38458, PECL bug #8944, PECL bug #7775 (error retrieving
   columns after long/text columns with PDO_ODBC). (Wez)
+- Fixed PECL bug #9061 (oci8 might reuse wrong persistent connection). (Tony)
 - Fixed PECL bug #8816 (issue in php_oci_statement_fetch with more than one 
   piecewise column) (jeff at badtz-maru dot com, Tony)
 - Fixed PECL bug #7755 (error selecting DOUBLE fields with PDO_ODBC).
index 8314e71fe1553fea9b6097fcdbced20a25ec1d7c..0956504a32a97ce4ad4162cb66c09271a5c435b5 100644 (file)
@@ -1104,15 +1104,19 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
                                                        /* server died */
                                                } else {
                                                        int rsrc_type;
+                                                       php_oci_connection *tmp;
 
                                                        /* okay, the connection is open and the server is still alive */
                                                        connection->used_this_request = 1;
-                                                       smart_str_free_ex(&hashed_details, 0);
-                                                       if (zend_list_find(connection->rsrc_id, &rsrc_type) && (rsrc_type == le_pconnection) && zend_list_addref(connection->rsrc_id) == SUCCESS) {
+                                                       tmp = (php_oci_connection *)zend_list_find(connection->rsrc_id, &rsrc_type);
+
+                                                       if (tmp != NULL && rsrc_type == le_pconnection && strlen(tmp->hash_key) == hashed_details.len &&
+                                                               memcmp(tmp->hash_key, hashed_details.c, hashed_details.len) == 0 && zend_list_addref(connection->rsrc_id) == SUCCESS) {
                                                                /* do nothing */
                                                        } else {
                                                                connection->rsrc_id = zend_list_insert(connection, le_pconnection);
                                                        }
+                                                       smart_str_free_ex(&hashed_details, 0);
                                                        return connection;
                                                }
                                        }