tony2001 Fri Nov 10 16:33:41 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/oci8 oci8.c oci8_statement.c php_oci8_int.h
Log:
fix segfault in ZTS mode when statements containing sub-statements are
destroyed in wrong order
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8.c?r1=1.269.2.16.2.25&r2=1.269.2.16.2.26&diff_format=u
Index: php-src/ext/oci8/oci8.c
diff -u php-src/ext/oci8/oci8.c:1.269.2.16.2.25
php-src/ext/oci8/oci8.c:1.269.2.16.2.26
--- php-src/ext/oci8/oci8.c:1.269.2.16.2.25 Wed Oct 18 14:23:23 2006
+++ php-src/ext/oci8/oci8.c Fri Nov 10 16:33:41 2006
@@ -26,7 +26,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c,v 1.269.2.16.2.25 2006/10/18 14:23:23 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.269.2.16.2.26 2006/11/10 16:33:41 tony2001 Exp $ */
/* TODO
*
* file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty()
with OCI_ATTR_LOBEMPTY
@@ -647,7 +647,9 @@
#ifdef ZTS
zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t)
php_oci_list_helper, (void *)le_descriptor TSRMLS_CC);
zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t)
php_oci_list_helper, (void *)le_collection TSRMLS_CC);
- zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t)
php_oci_list_helper, (void *)le_statement TSRMLS_CC);
+ while (OCI_G(num_statements)) {
+ zend_hash_apply_with_argument(&EG(regular_list),
(apply_func_arg_t) php_oci_list_helper, (void *)le_statement TSRMLS_CC);
+ }
#endif
/* check persistent connections and do the necessary actions if needed
*/
@@ -668,7 +670,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
php_info_print_table_row(2, "Version", "1.2.2");
- php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.25 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.26 $");
sprintf(buf, "%ld", OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
@@ -1810,13 +1812,13 @@
static int php_oci_list_helper(zend_rsrc_list_entry *le, void *le_type
TSRMLS_DC)
{
int type = (int) le_type;
-
+
if (le->type == type) {
- if (le->ptr != NULL) {
- return 1;
+ if (le->ptr != NULL && --le->refcount<=0) {
+ return ZEND_HASH_APPLY_REMOVE;
}
}
- return 0;
+ return ZEND_HASH_APPLY_KEEP;
} /* }}} */
#endif
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_statement.c?r1=1.7.2.14.2.13&r2=1.7.2.14.2.14&diff_format=u
Index: php-src/ext/oci8/oci8_statement.c
diff -u php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.13
php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.14
--- php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.13 Fri Oct 13 14:26:34 2006
+++ php-src/ext/oci8/oci8_statement.c Fri Nov 10 16:33:41 2006
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_statement.c,v 1.7.2.14.2.13 2006/10/13 14:26:34 tony2001 Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.14 2006/11/10 16:33:41 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
@@ -113,6 +113,8 @@
}
PHP_OCI_REGISTER_RESOURCE(statement, le_statement);
+
+ OCI_G(num_statements)++;
return statement;
}
@@ -520,6 +522,7 @@
outcol->retlen = -1;
dynamic = OCI_DEFAULT;
buf = &(outcol->statement->stmt);
+ zend_list_addref(statement->id);
break;
case SQLT_RDD: /* ROWID */
@@ -694,6 +697,8 @@
zend_list_delete(statement->connection->rsrc_id);
efree(statement);
+
+ OCI_G(num_statements)--;
} /* }}} */
/* {{{ php_oci_bind_pre_exec()
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/php_oci8_int.h?r1=1.11.2.6.2.7&r2=1.11.2.6.2.8&diff_format=u
Index: php-src/ext/oci8/php_oci8_int.h
diff -u php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.7
php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.8
--- php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.7 Tue Aug 22 11:09:12 2006
+++ php-src/ext/oci8/php_oci8_int.h Fri Nov 10 16:33:41 2006
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_oci8_int.h,v 1.11.2.6.2.7 2006/08/22 11:09:12 tony2001 Exp $ */
+/* $Id: php_oci8_int.h,v 1.11.2.6.2.8 2006/11/10 16:33:41 tony2001 Exp $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_INT_H
@@ -411,6 +411,7 @@
long max_persistent; /* maximum number of persistent connections per
process */
long num_persistent; /* number of existing persistent connections */
long num_links; /* non-persistent + persistent
connections */
+ long num_statements; /* number of statements open */
long ping_interval; /* time interval between pings */
long persistent_timeout; /* time period after which idle
persistent connection is considered expired */
long statement_cache_size; /* statement cache size. used with 9i+
clients only*/
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php