Index: ext/oci8/oci8.c =================================================================== RCS file: /repository/php-src/ext/oci8/oci8.c,v retrieving revision 1.269.2.16.2.43 diff -u -p -r1.269.2.16.2.43 oci8.c --- ext/oci8/oci8.c 10 Apr 2008 21:53:46 -0000 1.269.2.16.2.43 +++ ext/oci8/oci8.c 22 Aug 2008 15:29:13 -0000 @@ -651,7 +651,7 @@ PHP_RSHUTDOWN_FUNCTION(oci) #ifdef PHP_OCI8_HAVE_COLLECTIONS zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_collection TSRMLS_CC); #endif - while (OCI_G(num_statements)) { + while (OCI_G(num_statements) > 0) { zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_statement TSRMLS_CC); } #endif @@ -660,7 +660,9 @@ PHP_RSHUTDOWN_FUNCTION(oci) zend_hash_apply(&EG(persistent_list), (apply_func_t) php_oci_persistent_helper TSRMLS_CC); #ifdef ZTS - zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_connection TSRMLS_CC); + while (OCI_G(num_links) > OCI_G(num_persistent)) { + zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_connection TSRMLS_CC); + } php_oci_cleanup_global_handles(TSRMLS_C); #endif @@ -1411,6 +1413,7 @@ open: connection->rsrc_id = zend_list_insert(connection, le_pconnection); zend_hash_update(&EG(persistent_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL); OCI_G(num_persistent)++; + OCI_G(num_links)++; } else if (!exclusive) { connection->rsrc_id = zend_list_insert(connection, le_connection); new_le.ptr = (void *)connection->rsrc_id;