diff options
author | Antony Dovgal <tony2001@php.net> | 2006-01-17 23:44:11 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2006-01-17 23:44:11 +0000 |
commit | 38beafe629aad4f542f0c9b5b270be1594ad3e21 (patch) | |
tree | c5bec3122ee39a066a3a129255846e6844a58fd6 | |
parent | b8dda54715e52a9a498f956186233519449c0ad8 (diff) | |
download | php-git-38beafe629aad4f542f0c9b5b270be1594ad3e21.tar.gz |
fix #36055 (possible OCI8 crash in multithreaded environment)
-rw-r--r-- | ext/oci8/oci8.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index b8257b6fda..e00861bedf 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -89,6 +89,7 @@ static void php_oci_collection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC); static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC); #ifdef ZTS +static int php_oci_statement_helper(zend_rsrc_list_entry *le TSRMLS_DC); static int php_oci_regular_helper(zend_rsrc_list_entry *le TSRMLS_DC); #endif static int php_oci_connection_ping(php_oci_connection * TSRMLS_DC); @@ -622,6 +623,10 @@ PHP_MSHUTDOWN_FUNCTION(oci) PHP_RSHUTDOWN_FUNCTION(oci) { +#ifdef ZTS + zend_hash_apply(&EG(regular_list), (apply_func_t) php_oci_statement_helper TSRMLS_CC); +#endif + /* check persistent connections and do the necessary actions if needed */ zend_hash_apply(&EG(persistent_list), (apply_func_t) php_oci_persistent_helper TSRMLS_CC); @@ -1745,6 +1750,21 @@ static int php_oci_regular_helper(zend_rsrc_list_entry *le TSRMLS_DC) } return 0; } /* }}} */ + +/* {{{ php_oci_statement_helper() + Helper function to destroy statements on thread shutdown in ZTS mode */ +static int php_oci_statement_helper(zend_rsrc_list_entry *le TSRMLS_DC) +{ + php_oci_statement *statement; + + if (le->type == le_statement) { + statement = (php_oci_statement *)le->ptr; + if (statement) { + return 1; + } + } + return 0; +} /* }}} */ #endif #endif /* HAVE_OCI8 */ |