Permalink
Browse files

- MFH: Added parameter TSRMLS_DC in zend_is_callable()

  • Loading branch information...
1 parent 11bc1de commit e304515ddb434bb887c9d93cf0b4dd30a2ed94e4 @felipensp felipensp committed Aug 2, 2008
View
@@ -2746,10 +2746,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, char **callable_name) /* {{{ */
+ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name TSRMLS_DC) /* {{{ */
{
- TSRMLS_FETCH();
-
return zend_is_callable_ex(callable, NULL, check_flags, callable_name, NULL, NULL, NULL TSRMLS_CC);
}
/* }}} */
View
@@ -278,7 +278,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, char **callable_name, int *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC);
-ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name);
+ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name TSRMLS_DC);
ZEND_API zend_bool zend_make_callable(zval *callable, char **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);
@@ -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, "%s() expects the argument (%s) to be a valid callback",
get_active_function_name(TSRMLS_C), error_handler_name?error_handler_name:"unknown");
efree(error_handler_name);
@@ -1578,7 +1578,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, "%s() expects the argument (%s) to be a valid callback",
get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name:"unknown");
efree(exception_handler_name);
@@ -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;
@@ -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;
@@ -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) {
View
@@ -2132,7 +2132,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 '%s' to be a valid callback", callback_name);
efree(callback_name);
RETURN_FALSE;
View
@@ -1420,7 +1420,7 @@ PHP_FUNCTION(mysqli_set_local_infile_handler)
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
/* 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 %s", callback_name);
efree(callback_name);
RETURN_FALSE;
View
@@ -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, "%s is not a callable function name error", func_name);
efree(func_name);
RETURN_FALSE;
View
@@ -1315,7 +1315,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_callabl
if (Z_TYPE_PP(replace) != IS_ARRAY && (Z_TYPE_PP(replace) != IS_OBJECT || !is_callable_replace))
convert_to_string_ex(replace);
if (is_callable_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, '%s', to be a valid callback", callback_name);
efree(callback_name);
*return_value = **subject;
View
@@ -809,7 +809,7 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info *
method = &callable;
}
- if (!method || !zend_is_callable(callable, 0, &fname)) {
+ if (!method || !zend_is_callable(callable, 0, &fname TSRMLS_CC)) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback" TSRMLS_CC);
if (fname) {
efree(fname);
@@ -479,7 +479,7 @@ static PHP_METHOD(SQLite, sqliteCreateFunction)
dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
PDO_CONSTRUCT_CHECK;
- if (!zend_is_callable(callback, 0, &cbname)) {
+ if (!zend_is_callable(callback, 0, &cbname TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname);
efree(cbname);
RETURN_FALSE;
@@ -551,13 +551,13 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate)
dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
PDO_CONSTRUCT_CHECK;
- if (!zend_is_callable(step_callback, 0, &cbname)) {
+ if (!zend_is_callable(step_callback, 0, &cbname TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname);
efree(cbname);
RETURN_FALSE;
}
efree(cbname);
- if (!zend_is_callable(fini_callback, 0, &cbname)) {
+ if (!zend_is_callable(fini_callback, 0, &cbname TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname);
efree(cbname);
RETURN_FALSE;
View
@@ -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, "%s is not callable", name);
efree(name);
RETURN_FALSE;
@@ -551,7 +551,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, "%s is not callable", name);
RETURN_FALSE;
}
View
@@ -1583,7 +1583,7 @@ 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)) {
efree(args);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument %d is not a valid callback", i+1);
efree(name);
View
@@ -1183,7 +1183,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_STRING(&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 %s::%s() does not exist", intern->inner.ce->name, method);
return FAILURE;
}
View
@@ -3354,14 +3354,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 `%s' is not callable", callable);
efree(callable);
return;
}
efree(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 `%s' is not callable", callable);
efree(callable);
return;
@@ -3405,7 +3405,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 `%s' is not callable", callable);
efree(callable);
return;
View
@@ -776,7 +776,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 %s", callback_name);
efree(callback_name);
RETURN_FALSE;
@@ -827,14 +827,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 %s", callback_name);
efree(callback_name);
RETURN_FALSE;
}
efree(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 %s", callback_name);
efree(callback_name);
RETURN_FALSE;
View
@@ -616,7 +616,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; \
@@ -5289,7 +5289,7 @@ static int user_shutdown_function_call(php_shutdown_function_entry *shutdown_fun
zval retval;
char *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 %s() - function does not exist", function_name);
if (function_name) {
efree(function_name);
@@ -5434,7 +5434,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 '%s' passed", function_name);
efree(shutdown_function_entry.arguments);
RETVAL_FALSE;
@@ -6021,7 +6021,7 @@ PHP_FUNCTION(register_tick_function)
RETURN_FALSE;
}
- if (!zend_is_callable(tick_fe.arguments[0], 0, &function_name)) {
+ if (!zend_is_callable(tick_fe.arguments[0], 0, &function_name TSRMLS_CC)) {
efree(tick_fe.arguments);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid tick callback '%s' passed", function_name);
efree(function_name);
View
@@ -368,11 +368,11 @@ 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);
zval_dtor(*callable_name);
ZVAL_STRING(*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);
@@ -949,7 +949,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;
View
@@ -418,7 +418,7 @@ static int php_ob_init_named(uint initial_size, uint block_size, char *handler_n
{
php_ob_buffer tmp_buf;
- if (output_handler && !zend_is_callable(output_handler, 0, NULL)) {
+ if (output_handler && !zend_is_callable(output_handler, 0, NULL TSRMLS_CC)) {
return FAILURE;
}
@@ -508,7 +508,7 @@ static int php_ob_init(uint initial_size, uint block_size, zval *output_handler,
}
} else if (output_handler && output_handler->type == IS_ARRAY) {
/* do we have array(object,method) */
- if (zend_is_callable(output_handler, 0, &handler_name)) {
+ if (zend_is_callable(output_handler, 0, &handler_name TSRMLS_CC)) {
SEPARATE_ZVAL(&output_handler);
Z_ADDREF_P(output_handler);
result = php_ob_init_named(initial_size, block_size, handler_name, output_handler, chunk_size, erase TSRMLS_CC);
@@ -527,7 +527,7 @@ static int php_ob_init(uint initial_size, uint block_size, zval *output_handler,
}
} else if (output_handler && output_handler->type == IS_OBJECT) {
/* do we have callable object */
- if (zend_is_callable(output_handler, 0, &handler_name)) {
+ if (zend_is_callable(output_handler, 0, &handler_name TSRMLS_CC)) {
SEPARATE_ZVAL(&output_handler);
Z_ADDREF_P(output_handler);
result = php_ob_init_named(initial_size, block_size, handler_name, output_handler, chunk_size, erase TSRMLS_CC);

0 comments on commit e304515

Please sign in to comment.