com php-src: Use ZPP callable check for oci_register_taf_ callback(): ext/oci8/oci8.stub.php ext/oci8 /oci8_arginfo.h ext/oci8/oci8_interface.c
| From: | Christopher Jones | Date: | Wed, 22 Jul 2020 07:29:30 +0000 |
| Subject: | com php-src: Use ZPP callable check for oci_register_taf_ callback(): ext/oci8/oci8.stub.php ext/oci8 /oci8_arginfo.h ext/oci8/oci8_interface.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-112305@lists.php.net to get a copy of this message | ||
Commit: 7a3375a08cc2433ab868d4e083efe6d1b72bcca3
Author: George Peter Banyard <girgias@php.net> Mon, 20 Jul 2020 17:34:57 +0100
Committer: Christopher Jones <sixd@php.net> Wed, 22 Jul 2020 17:29:30 +1000
Parents: 0d146cb3eba487c4e1d4b554072c30cc4d394cd8
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7a3375a08cc2433ab868d4e083efe6d1b72bcca3
Log:
Use ZPP callable check for oci_register_taf_callback()
Changed paths:
M ext/oci8/oci8.stub.php
M ext/oci8/oci8_arginfo.h
M ext/oci8/oci8_interface.c
Diff:
diff --git a/ext/oci8/oci8.stub.php b/ext/oci8/oci8.stub.php
index cf870f8acb..d53caed69b 100644
--- a/ext/oci8/oci8.stub.php
+++ b/ext/oci8/oci8.stub.php
@@ -614,9 +614,8 @@ function ocinewcollection($connection_resource, string $type_name, string $schem
/**
* @param resource $connection_resource
- * @param callable|null $function_name
*/
-function oci_register_taf_callback($connection_resource, $function_name): bool {}
+function oci_register_taf_callback($connection_resource, ?callable $function_name): bool {}
/**
* @param resource $connection_resource
@@ -805,4 +804,4 @@ class OCI_Collection {
* @return bool
*/
public function trim(int $number) {}
-}
\ No newline at end of file
+}
diff --git a/ext/oci8/oci8_arginfo.h b/ext/oci8/oci8_arginfo.h
index 90aee86841..c82656f205 100644
--- a/ext/oci8/oci8_arginfo.h
+++ b/ext/oci8/oci8_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 157a4128645b816f23fb0bcbbb5860362f446cb3 */
+ * Stub hash: 4a4e86dc175542bbf0bc29c9a957c5dfec834f93 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement_resource)
@@ -433,7 +433,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_register_taf_callback, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, connection_resource)
- ZEND_ARG_INFO(0, function_name)
+ ZEND_ARG_TYPE_INFO(0, function_name, IS_CALLABLE, 1)
ZEND_END_ARG_INFO()
#define arginfo_oci_unregister_taf_callback arginfo_oci_rollback
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 689ac1c2e0..2ecf1d4bc4 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -45,25 +45,21 @@ PHP_FUNCTION(oci_register_taf_callback)
{
zval *z_connection;
php_oci_connection *connection;
- zval *callback;
- zend_string *callback_name;
+ zend_fcall_info fci;
+ zend_fcall_info_cache fcc;
+ zval *callback = NULL;
- /* TODO Use ZPP callable */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!", &z_connection, &callback) ==
FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|f!", &z_connection, &fci,
&fcc) == FAILURE) {
RETURN_THROWS();
}
- if (callback) {
- if (!zend_is_callable(callback, 0, 0)) {
- callback_name = zend_get_callable_name(callback);
- php_error_docref(NULL, E_WARNING, "Function '%s' is not callable",
ZSTR_VAL(callback_name));
- zend_string_release(callback_name);
- RETURN_FALSE;
- }
- }
-
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
+ /* If callable passed, assign callback zval so that it can be passed to
php_oci_register_taf_callback() */
+ if (ZEND_FCI_INITIALIZED(fci)) {
+ callback = &fci.function_name;
+ }
+
if (php_oci_register_taf_callback(connection, callback) == 0) {
RETURN_TRUE;
} else {