From: Felipe Pena Date: Sat, 2 Aug 2008 04:40:45 +0000 (+0000) Subject: - Added parameter TSRMLS_DC in zend_is_callable() X-Git-Tag: BEFORE_HEAD_NS_CHANGE~908 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=611ecc5111784936a306a98c10b9d74a2ab7d1eb;p=php - Added parameter TSRMLS_DC in zend_is_callable() --- diff --git a/Zend/zend_API.c b/Zend/zend_API.c index be2b46b9c5..bb6a7218b2 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3272,10 +3272,8 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval **object_pp, uint ch } /* }}} */ -ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, zval *callable_name) /* {{{ */ +ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, zval *callable_name TSRMLS_DC) /* {{{ */ { - TSRMLS_FETCH(); - return zend_is_callable_ex(callable, NULL, check_flags, callable_name, NULL, NULL TSRMLS_CC); } /* }}} */ diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 34b1c2c692..598d348d38 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -285,7 +285,7 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D); #define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC) ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval **object_pp, uint check_flags, zval *callable_name, zend_fcall_info_cache *fcc, char **error TSRMLS_DC); -ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, zval *callable_name); +ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, zval *callable_name TSRMLS_DC); ZEND_API zend_bool zend_make_callable(zval *callable, zval *callable_name TSRMLS_DC); ZEND_API const char *zend_get_module_version(const char *module_name); ZEND_API int zend_get_module_started(char *module_name); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index b74265f9e6..715219a54c 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1506,7 +1506,7 @@ ZEND_FUNCTION(set_error_handler) return; } - if (!zend_is_callable(error_handler, 0, &error_handler_name)) { + if (!zend_is_callable(error_handler, 0, &error_handler_name TSRMLS_CC)) { zend_error(E_WARNING, "%v() expects the argument (%R) to be a valid callback", get_active_function_name(TSRMLS_C), Z_TYPE(error_handler_name), Z_UNIVAL(error_handler_name)); zval_dtor(&error_handler_name); @@ -1576,7 +1576,7 @@ ZEND_FUNCTION(set_exception_handler) } if (Z_TYPE_P(exception_handler) != IS_NULL) { /* NULL == unset */ - if (!zend_is_callable(exception_handler, 0, &exception_handler_name)) { + if (!zend_is_callable(exception_handler, 0, &exception_handler_name TSRMLS_CC)) { zend_error(E_WARNING, "%v() expects the argument (%R) to be a valid callback", get_active_function_name(TSRMLS_C), Z_TYPE(exception_handler_name), Z_UNIVAL(exception_handler_name)); zval_dtor(&exception_handler_name); diff --git a/ext/filter/callback_filter.c b/ext/filter/callback_filter.c index 62c14e335f..b500c5b4ed 100644 --- a/ext/filter/callback_filter.c +++ b/ext/filter/callback_filter.c @@ -26,7 +26,7 @@ void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL) zval ***args; int status; - if (!option_array || !zend_is_callable(option_array, IS_CALLABLE_CHECK_NO_ACCESS, NULL)) { + if (!option_array || !zend_is_callable(option_array, IS_CALLABLE_CHECK_NO_ACCESS, NULL TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argument is expected to be a valid callback"); zval_dtor(value); Z_TYPE_P(value) = IS_NULL; diff --git a/ext/interbase/ibase_events.c b/ext/interbase/ibase_events.c index f5d303c2db..b4c204ba26 100644 --- a/ext/interbase/ibase_events.c +++ b/ext/interbase/ibase_events.c @@ -304,7 +304,7 @@ PHP_FUNCTION(ibase_set_event_handler) } /* get the callback */ - if (!zend_is_callable(*cb_arg, 0, NULL)) { + if (!zend_is_callable(*cb_arg, 0, NULL TSRMLS_CC)) { _php_ibase_module_error("Callback argument %s is not a callable function" TSRMLS_CC, Z_STRVAL_PP(cb_arg)); RETURN_FALSE; diff --git a/ext/interbase/php_ibase_udf.c b/ext/interbase/php_ibase_udf.c index 4bdeb87dfb..3945d465b7 100644 --- a/ext/interbase/php_ibase_udf.c +++ b/ext/interbase/php_ibase_udf.c @@ -192,10 +192,14 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) INIT_ZVAL(callback); ZVAL_STRING(&callback,name,0); + LOCK(); + /* check if the requested function exists */ - if (!zend_is_callable(&callback, 0, NULL)) { + if (!zend_is_callable(&callback, 0, NULL TSRMLS_CC)) { break; } + + UNLOCK(); /* create the argument array */ for (i = 0; i < argc; ++i) { diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 0622d1e622..57d852bd71 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -2140,7 +2140,7 @@ PHP_FUNCTION(ldap_set_rebind_proc) } /* callable? */ - if (!zend_is_callable(callback, 0, &callback_name)) { + if (!zend_is_callable(callback, 0, &callback_name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Two arguments expected for '%R' to be a valid callback", Z_TYPE(callback_name), Z_UNIVAL(callback_name)); zval_dtor(&callback_name); RETURN_FALSE; diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 03c041a115..44f103628c 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -1477,7 +1477,7 @@ PHP_FUNCTION(mysqli_set_local_infile_handler) } /* check callback function */ - if (!zend_is_callable(callback_func, 0, &callback_name)) { + if (!zend_is_callable(callback_func, 0, &callback_name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback function %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name)); zval_dtor(&callback_name); RETURN_FALSE; diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index b0fa81007c..f29588c66f 100755 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -728,7 +728,7 @@ PHP_FUNCTION(pcntl_signal) RETURN_TRUE; } - if (!zend_is_callable(handle, 0, &func_name)) { + if (!zend_is_callable(handle, 0, &func_name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%R is not a callable function name error", Z_TYPE(func_name), Z_UNIVAL(func_name)); zval_dtor(&func_name); RETURN_FALSE; diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 2e7638ed51..f1ee5585c3 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1463,7 +1463,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_callabl if (Z_TYPE_P(replace) != IS_ARRAY && Z_TYPE_P(replace) != IS_OBJECT) { convert_to_text(replace); } - if (!zend_is_callable(replace, 0, &callback_name)) { + if (!zend_is_callable(replace, 0, &callback_name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires argument 2, '%R', to be a valid callback", Z_TYPE(callback_name), Z_UNIVAL(callback_name)); zval_dtor(&callback_name); *return_value = *subject; diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 8d79061138..63b75bf0b9 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -802,7 +802,7 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * method = &callable; } - if (!method || !zend_is_callable(callable, 0, NULL)) { + if (!method || !zend_is_callable(callable, 0, NULL TSRMLS_CC)) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback" TSRMLS_CC); return 0; } diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index e63dde7069..02fce50198 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -502,7 +502,7 @@ static PHP_METHOD(SQLite, sqliteCreateFunction) dbh = zend_object_store_get_object(getThis() TSRMLS_CC); PDO_CONSTRUCT_CHECK; - if (!zend_is_callable(callback, 0, NULL)) { + if (!zend_is_callable(callback, 0, NULL TSRMLS_CC)) { pdo_sqlite_errmsg(dbh, NULL, "callback is not callable"); RETURN_FALSE; } @@ -571,11 +571,11 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate) dbh = zend_object_store_get_object(getThis() TSRMLS_CC); PDO_CONSTRUCT_CHECK; - if (!zend_is_callable(step_callback, 0, NULL)) { + if (!zend_is_callable(step_callback, 0, NULL TSRMLS_CC)) { pdo_sqlite_errmsg(dbh, NULL, "step callback is not callable"); RETURN_FALSE; } - if (!zend_is_callable(fini_callback, 0, NULL)) { + if (!zend_is_callable(fini_callback, 0, NULL TSRMLS_CC)) { pdo_sqlite_errmsg(dbh, NULL, "fini callback is not callable"); RETURN_FALSE; } diff --git a/ext/readline/readline.c b/ext/readline/readline.c index ba68438978..2f53028e64 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -499,7 +499,7 @@ PHP_FUNCTION(readline_completion_function) RETURN_FALSE; } - if (!zend_is_callable(arg, 0, &name)) { + if (!zend_is_callable(arg, 0, &name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%R is not callable", Z_TYPE(name), Z_UNIVAL(name)); zval_dtor(&name); RETURN_FALSE; @@ -552,7 +552,7 @@ PHP_FUNCTION(readline_callback_handler_install) return; } - if (!zend_is_callable(callback, 0, &name)) { + if (!zend_is_callable(callback, 0, &name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%R is not callable", Z_TYPE(name), Z_UNIVAL(name)); zval_dtor(&name); RETURN_FALSE; diff --git a/ext/session/session.c b/ext/session/session.c index 6b0fe71e13..b1b8127124 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -1490,7 +1490,7 @@ static PHP_FUNCTION(session_set_save_handler) for (i = 0; i < 6; i++) { - if (!zend_is_callable(*args[i], 0, &name)) { + if (!zend_is_callable(*args[i], 0, &name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument %d is not a valid callback", i+1); zval_dtor(&name); RETURN_FALSE; diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 76dd0805b1..23fa15b10c 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1234,7 +1234,7 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS) intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); ZVAL_TEXT(&func, method, 0); - if (!zend_is_callable(&func, 0, &method)) { + if (!zend_is_callable(&func, 0, &method TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Method %v::%R() does not exist", intern->inner.ce->name, Z_TYPE(method), Z_UNIVAL(method)); return FAILURE; } diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c index 15f9d25dee..049eea4d50 100644 --- a/ext/sqlite/sqlite.c +++ b/ext/sqlite/sqlite.c @@ -3556,14 +3556,14 @@ PHP_FUNCTION(sqlite_create_aggregate) DB_FROM_ZVAL(db, &zdb); } - if (!zend_is_callable(zstep, 0, &callable)) { + if (!zend_is_callable(zstep, 0, &callable TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "step function `%R' is not callable", Z_TYPE(callable), Z_UNIVAL(callable)); zval_dtor(&callable); return; } zval_dtor(&callable); - if (!zend_is_callable(zfinal, 0, &callable)) { + if (!zend_is_callable(zfinal, 0, &callable TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "finalize function `%R' is not callable", Z_TYPE(callable), Z_UNIVAL(callable)); zval_dtor(&callable); return; @@ -3607,7 +3607,7 @@ PHP_FUNCTION(sqlite_create_function) DB_FROM_ZVAL(db, &zdb); } - if (!zend_is_callable(zcall, 0, &callable)) { + if (!zend_is_callable(zcall, 0, &callable TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "function `%R' is not callable", Z_TYPE(callable), Z_UNIVAL(callable)); zval_dtor(&callable); return; diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 27c55e1ae3..7b33edb698 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -801,7 +801,7 @@ PHP_METHOD(sqlite3, createFunction) RETURN_FALSE; } - if (!zend_is_callable(callback_func, 0, &callback_name)) { + if (!zend_is_callable(callback_func, 0, &callback_name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback function %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name)); zval_dtor(&callback_name); RETURN_FALSE; @@ -853,14 +853,14 @@ PHP_METHOD(sqlite3, createAggregate) RETURN_FALSE; } - if (!zend_is_callable(step_callback, 0, &callback_name)) { + if (!zend_is_callable(step_callback, 0, &callback_name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback function %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name)); zval_dtor(&callback_name); RETURN_FALSE; } zval_dtor(&callback_name); - if (!zend_is_callable(fini_callback, 0, &callback_name)) { + if (!zend_is_callable(fini_callback, 0, &callback_name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback function %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name)); zval_dtor(&callback_name); RETURN_FALSE; diff --git a/ext/standard/array.c b/ext/standard/array.c index 6b9021d4da..fe0da87644 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -628,7 +628,7 @@ static int php_array_user_compare(const void *a, const void *b TSRMLS_DC) /* {{{ /* check if comparison function is valid */ #define PHP_ARRAY_CMP_FUNC_CHECK(func_name) \ - if (!zend_is_callable(*func_name, 0, NULL)) { \ + if (!zend_is_callable(*func_name, 0, NULL TSRMLS_CC)) { \ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid comparison function"); \ BG(user_compare_fci) = old_user_compare_fci; \ BG(user_compare_fci_cache) = old_user_compare_fci_cache; \ diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index e29e7caff7..7a55928b70 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5298,7 +5298,7 @@ static int user_shutdown_function_call(php_shutdown_function_entry *shutdown_fun zval retval; zval function_name; - if (!zend_is_callable(shutdown_function_entry->arguments[0], 0, &function_name)) { + if (!zend_is_callable(shutdown_function_entry->arguments[0], 0, &function_name TSRMLS_CC)) { php_error(E_WARNING, "(Registered shutdown functions) Unable to call %R() - function does not exist", Z_TYPE(function_name), Z_UNIVAL(function_name)); zval_dtor(&function_name); return 0; @@ -5441,7 +5441,7 @@ PHP_FUNCTION(register_shutdown_function) } /* Prevent entering of anything but valid callback (syntax check only!) */ - if (!zend_is_callable(shutdown_function_entry.arguments[0], 0, &function_name)) { + if (!zend_is_callable(shutdown_function_entry.arguments[0], 0, &function_name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid shutdown callback '%R' passed", Z_TYPE(function_name), Z_UNIVAL(function_name)); efree(shutdown_function_entry.arguments); RETVAL_FALSE; diff --git a/ext/standard/type.c b/ext/standard/type.c index 19ca9d03be..9fde3a4951 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -470,10 +470,10 @@ PHP_FUNCTION(is_callable) syntax_only = syntax_only ? IS_CALLABLE_CHECK_SYNTAX_ONLY : 0; if (ZEND_NUM_ARGS() > 2) { - retval = zend_is_callable(var, syntax_only, &name); + retval = zend_is_callable(var, syntax_only, &name TSRMLS_CC); REPLACE_ZVAL_VALUE(callable_name, &name, 0); } else { - retval = zend_is_callable(var, syntax_only, NULL); + retval = zend_is_callable(var, syntax_only, NULL TSRMLS_CC); } RETURN_BOOL(retval); diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c index e1d706b96f..575f10ef09 100644 --- a/ext/sybase_ct/php_sybase_ct.c +++ b/ext/sybase_ct/php_sybase_ct.c @@ -2363,7 +2363,7 @@ PHP_FUNCTION(sybase_set_message_handler) case IS_ARRAY: case IS_STRING: /* Either "function", array("class", "function") or array($object, "function") */ - if (!zend_is_callable(*param, 0, &name)) { + if (!zend_is_callable(*param, 0, &name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argumented is expected to be a valid callback, '%R' was given", Z_TYPE(name), Z_UNIVAL(name)); zval_dtor(&name); RETURN_FALSE; diff --git a/ext/unicode/property.c b/ext/unicode/property.c index 6baf59611e..c7ecf3d9f9 100644 --- a/ext/unicode/property.c +++ b/ext/unicode/property.c @@ -868,7 +868,7 @@ PHP_FUNCTION(char_enum_names) return; } - if (!zend_is_callable(callback, 0, NULL)) { + if (!zend_is_callable(callback, 0, NULL TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid enumeration callback"); return; } @@ -927,7 +927,7 @@ PHP_FUNCTION(char_enum_types) return; } - if (!zend_is_callable(callback, 0, NULL)) { + if (!zend_is_callable(callback, 0, NULL TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid enumeration callback"); return; } diff --git a/ext/unicode/unicode.c b/ext/unicode/unicode.c index d81eb2aae6..6a0fc09c45 100644 --- a/ext/unicode/unicode.c +++ b/ext/unicode/unicode.c @@ -237,7 +237,7 @@ PHP_FUNCTION(unicode_set_error_handler) } if (Z_TYPE_P(error_handler) != IS_NULL) { /* NULL == unset */ - if (!zend_is_callable(error_handler, 0, &error_handler_name)) { + if (!zend_is_callable(error_handler, 0, &error_handler_name TSRMLS_CC)) { zend_error(E_WARNING, "%v() expects the argument (%R) to be a valid callback", get_active_function_name(TSRMLS_C), Z_TYPE(error_handler_name), Z_UNIVAL(error_handler_name)); zval_dtor(&error_handler_name); diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 825b263ff3..835688ad4d 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -964,7 +964,7 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data) zend_hash_internal_pointer_reset(Z_ARRVAL_P(pData->server->introspection_map)); while(1) { if(zend_hash_get_current_data(Z_ARRVAL_P(pData->server->introspection_map), (void**)&php_function) == SUCCESS) { - if (zend_is_callable(*php_function, 0, &php_function_name)) { + if (zend_is_callable(*php_function, 0, &php_function_name TSRMLS_CC)) { /* php func prototype: function string user_func($user_params) */ if (call_user_function(CG(function_table), NULL, *php_function, &retval, 1, callback_params TSRMLS_CC) == SUCCESS) { XMLRPC_VALUE xData;