diff --git a/NEWS b/NEWS
index ff9dba5fc4a..8e41ef02b84 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,9 @@ PHP NEWS
. Fixed bug #74968 (PHP crashes when calling mysqli_result::fetch_object with
an abstract class). (Anatol)
+- OCI8:
+ . Expose oci_unregister_taf_callback() (Tianfang Yang)
+
- SimpleXML:
. Fixed bug #74950 (nullpointer deref in simplexml_element_getDocNamespaces).
(Laruence)
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 084655103ff..93e7bce2a38 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -509,6 +509,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_register_taf_callback, 0, 0, 1)
ZEND_ARG_INFO(0, connection_resource)
ZEND_ARG_INFO(0, function_name)
ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_unregister_taf_callback, 0, 0, 1)
+ ZEND_ARG_INFO(0, connection_resource)
+ZEND_END_ARG_INFO()
/* }}} */
/* {{{ LOB Method arginfo */
@@ -707,6 +711,7 @@ PHP_FUNCTION(oci_collection_size);
PHP_FUNCTION(oci_collection_max);
PHP_FUNCTION(oci_collection_trim);
PHP_FUNCTION(oci_register_taf_callback);
+PHP_FUNCTION(oci_unregister_taf_callback);
/* }}} */
/* {{{ extension definition structures
@@ -790,6 +795,7 @@ static const zend_function_entry php_oci_functions[] = {
PHP_FE(oci_collection_trim, arginfo_oci_collection_trim)
PHP_FE(oci_new_collection, arginfo_oci_new_collection)
PHP_FE(oci_register_taf_callback, arginfo_oci_register_taf_callback)
+ PHP_FE(oci_unregister_taf_callback, arginfo_oci_unregister_taf_callback)
PHP_FALIAS(oci_free_cursor, oci_free_statement, arginfo_oci_free_statement)
PHP_FALIAS(ocifreecursor, oci_free_statement, arginfo_oci_free_statement)
@@ -2702,7 +2708,7 @@ static int php_oci_persistent_helper(zval *zv)
/* Remove TAF callback function as it's bound to current request */
if (connection->used_this_request && !Z_ISUNDEF(connection->taf_callback) && !Z_ISNULL(connection->taf_callback)) {
- php_oci_disable_taf_callback(connection);
+ php_oci_unregister_taf_callback(connection);
}
if (!connection->used_this_request && OCI_G(persistent_timeout) != -1) {
diff --git a/ext/oci8/oci8_failover.c b/ext/oci8/oci8_failover.c
index 9350f370e54..4bc522b8650 100644
--- a/ext/oci8/oci8_failover.c
+++ b/ext/oci8/oci8_failover.c
@@ -40,29 +40,30 @@
#include "php_oci8.h"
#include "php_oci8_int.h"
-/* {{{ callback_fn()
+/* {{{ callback_fn()
OCI TAF callback function, calling userspace function */
-sb4 callback_fn(OCISvcCtx *svchp, OCIEnv *envhp, php_oci_connection *fo_ctx, ub4 fo_type, ub4 fo_event)
+sb4 callback_fn(void *svchp, void *envhp, void *fo_ctx, ub4 fo_type, ub4 fo_event)
{
/* Create zval */
zval retval, params[3];
+ php_oci_connection *connection = (php_oci_connection*)fo_ctx;
/* Default return value */
sb4 returnValue = 0;
- /* Check if userspace callback function was disabled */
- if (Z_ISUNDEF(fo_ctx->taf_callback) || Z_ISNULL(fo_ctx->taf_callback)) {
+ /* Check if userspace callback function was unregistered */
+ if (Z_ISUNDEF(connection->taf_callback) || Z_ISNULL(connection->taf_callback)) {
return 0;
}
/* Initialize zval */
- ZVAL_RES(¶ms[0], fo_ctx->id);
+ ZVAL_RES(¶ms[0], connection->id);
ZVAL_LONG(¶ms[1], fo_event);
ZVAL_LONG(¶ms[2], fo_type);
/* Call user function (if possible) */
- if (call_user_function(EG(function_table), NULL, &fo_ctx->taf_callback, &retval, 3, params) == FAILURE) {
- php_error_docref(NULL, E_WARNING, "Unable to call taf callback function, is it defined?");
+ if (call_user_function(EG(function_table), NULL, &connection->taf_callback, &retval, 3, params) == FAILURE) {
+ php_error_docref(NULL, E_WARNING, "Unable to call Oracle TAF callback function");
}
/* Set return value */
@@ -83,10 +84,10 @@ sb4 callback_fn(OCISvcCtx *svchp, OCIEnv *envhp, php_oci_connection *fo_ctx, ub4
}
/* }}} */
-/* {{{ php_oci_disable_taf_callback()
- Disables the userspace callback function for Oracle TAF,
+/* {{{ php_oci_unregister_taf_callback()
+ Unregister the userspace callback function for Oracle TAF,
while keeping the OCI callback alive */
-int php_oci_disable_taf_callback(php_oci_connection *connection)
+int php_oci_unregister_taf_callback(php_oci_connection *connection)
{
return php_oci_register_taf_callback(connection, NULL);
}
@@ -103,9 +104,9 @@ int php_oci_register_taf_callback(php_oci_connection *connection, zval *callback
OCIFocbkStruct failover;
if (!callback) {
- /* Disable callback */
+ /* Unregister callback */
if (Z_ISUNDEF(connection->taf_callback) || Z_ISNULL(connection->taf_callback)) {
- return 0; // Nothing to disable
+ return 0; // Nothing to unregister
}
registered = 1;
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 0649575b5b4..b0a81048276 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -75,6 +75,27 @@ PHP_FUNCTION(oci_register_taf_callback)
}
/* }}} */
+/* {{{ proto bool oci_unregister_taf_callback( resource connection )
+ * Unregister a callback function for Oracle Transparent Application Failover (TAF) */
+PHP_FUNCTION(oci_unregister_taf_callback)
+{
+ zval *z_connection;
+ php_oci_connection *connection;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_connection) == FAILURE) {
+ return;
+ }
+
+ PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
+
+ if (php_oci_unregister_taf_callback(connection) == 0) {
+ RETURN_TRUE;
+ } else {
+ RETURN_FALSE;
+ }
+}
+/* }}} */
+
/* {{{ proto bool oci_define_by_name(resource stmt, string name, mixed &var [, int type])
Define a PHP variable to an Oracle column by name */
/* if you want to define a LOB/CLOB etc make sure you allocate it via OCINewDescriptor BEFORE defining!!! */
@@ -1587,8 +1608,8 @@ PHP_FUNCTION(oci_close)
RefCount value by 1 */
zend_list_close(connection->id);
- /* Disable Oracle TAF */
- php_oci_disable_taf_callback(connection);
+ /* Unregister Oracle TAF */
+ php_oci_unregister_taf_callback(connection);
/* ZVAL_NULL(z_connection); */
diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml
index 450777bcf74..17bd40cd3cf 100644
--- a/ext/oci8/package.xml
+++ b/ext/oci8/package.xml
@@ -50,8 +50,8 @@ Interoperability Support" (ID 207303.1) for details.
- 2.1.6
- 2.1.6
+ 2.1.7
+ 2.1.7
stable
@@ -60,7 +60,7 @@ Interoperability Support" (ID 207303.1) for details.
PHP
This version is for PHP 7 only.
-Fixed bug #74625 (Integer overflow in oci_bind_array_by_name). (Ingmar Runge)
+Added oci_unregister_taf_callback()
@@ -470,6 +470,22 @@ Fixed bug #74625 (Integer overflow in oci_bind_array_by_name). (Ingmar Runge)
+
+
+ 2.1.6
+ 2.1.6
+
+
+ stable
+ stable
+
+ PHP
+
+This version is for PHP 7 only.
+Fixed bug #74625 (Integer overflow in oci_bind_array_by_name). (Ingmar Runge)
+
+
+
2.1.5
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index 04434f1f68e..c236f6c19f9 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -43,7 +43,7 @@
*/
#undef PHP_OCI8_VERSION
#endif
-#define PHP_OCI8_VERSION "2.1.6"
+#define PHP_OCI8_VERSION "2.1.7"
extern zend_module_entry oci8_module_entry;
#define phpext_oci8_ptr &oci8_module_entry
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index 06a88f4c84a..5e74bb0096c 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -536,7 +536,7 @@ ZEND_END_MODULE_GLOBALS(oci) /* }}} */
/* {{{ transparent failover related prototypes */
int php_oci_register_taf_callback(php_oci_connection *connection, zval *callback);
-int php_oci_disable_taf_callback(php_oci_connection *connection);
+int php_oci_unregister_taf_callback(php_oci_connection *connection);
/* }}} */
diff --git a/ext/oci8/tests/driver_name.phpt b/ext/oci8/tests/driver_name.phpt
index 49616a00ad6..1ea885bf4f8 100644
--- a/ext/oci8/tests/driver_name.phpt
+++ b/ext/oci8/tests/driver_name.phpt
@@ -57,11 +57,11 @@ function get_attr($conn)
?>
--EXPECT--
**Test 1.1 - Default values for the attribute **************
-The value of DRIVER_NAME is PHP OCI8 : 2.1.6
+The value of DRIVER_NAME is PHP OCI8 : 2.1.7
***Test 1.2 - Get the values from different connections **************
Testing with oci_pconnect()
-The value of DRIVER_NAME is PHP OCI8 : 2.1.6
+The value of DRIVER_NAME is PHP OCI8 : 2.1.7
Testing with oci_new_connect()
-The value of DRIVER_NAME is PHP OCI8 : 2.1.6
+The value of DRIVER_NAME is PHP OCI8 : 2.1.7
Done