com php-src: Expose oci_unregister_taf_callback(): NEWS ext/oci8/oci8.c ext/oci8/oci8_failover .c ext/oci8/oci8_interface.c ext/oci8/package .xml
ext/oci8/php_oci8.h ext/oci8/php_oci8 _int.h ext/oci8/tests/driver_name.phpt

From: Date: Wed, 26 Jul 2017 05:22:44 +0000
Subject: com php-src: Expose oci_unregister_taf_callback(): NEWS ext/oci8/oci8.c ext/oci8/oci8_failover .c ext/oci8/oci8_interface.c ext/oci8/package .xml
ext/oci8/php_oci8.h ext/oci8/php_oci8 _int.h ext/oci8/tests/driver_name.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-98809@lists.php.net to get a copy of this message
Commit: de65a2243f5e52ccafc69889ab0b64f4481c5358 Author: Christopher Jones <sixd@php.net> Wed, 26 Jul 2017 15:22:44 +1000 Parents: 3fd7d819b8ea164bdf255cddcd0a1b1d156f4a3b Branches: PHP-7.0 PHP-7.1 PHP-7.2 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=de65a2243f5e52ccafc69889ab0b64f4481c5358 Log: Expose oci_unregister_taf_callback() Changed paths: M NEWS M ext/oci8/oci8..c M ext/oci8/oci8_failover.c M ext/oci8/oci8_interface.c M ext/oci8/package.xml M ext/oci8/php_oci8.h M ext/oci8/php_oci8_int.h M ext/oci8/tests/driver_name.phpt

diff --git a/NEWS b/NEWS index ff9dba5..8e41ef0 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 0846551..93e7bce 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 9350f37..4bc522b 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(&params[0], fo_ctx->id); + ZVAL_RES(&params[0], connection->id); ZVAL_LONG(&params[1], fo_event); ZVAL_LONG(&params[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 0649575..b0a8104 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 450777b..17bd40c 100644 --- a/ext/oci8/package.xml +++ b/ext/oci8/package.xml @@ -50,8 +50,8 @@ Interoperability Support" (ID 207303.1) for details. <time>12:00:00</time> <version> - <release>2.1.6</release> - <api>2.1.6</api> + <release>2.1.7</release> + <api>2.1.7</api> </version> <stability> <release>stable</release> @@ -60,7 +60,7 @@ Interoperability Support" (ID 207303.1) for details. <license uri="http://www.php.net/license">PHP</license> <notes> 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() </notes> <contents> <dir name="/"> @@ -470,6 +470,22 @@ Fixed bug #74625 (Integer overflow in oci_bind_array_by_name). (Ingmar Runge) </extsrcrelease> <changelog> +<release> + <version> + <release>2.1.6</release> + <api>2.1.6</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://www.php.net/license">PHP</license> + <notes> +This version is for PHP 7 only. +Fixed bug #74625 (Integer overflow in oci_bind_array_by_name). (Ingmar Runge) + </notes> +</release> + <release> <version> <release>2.1.5</release> diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h index 04434f1..c236f6c 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 06a88f4..5e74bb0 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 49616a0..1ea885b 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
« previous php.cvs (#98809) next »