ZEND_FUNCTION(set_error_handler)
{
zval *error_handler;
- zend_string *error_handler_name = NULL;
zend_long error_type = E_ALL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &error_handler, &error_type) == FAILURE) {
}
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, NULL)) {
+ zend_string *error_handler_name = zend_get_callable_name(error_handler);
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
get_active_function_name(), error_handler_name?ZSTR_VAL(error_handler_name):"unknown");
zend_string_release(error_handler_name);
return;
}
- zend_string_release(error_handler_name);
}
if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
ZEND_FUNCTION(set_exception_handler)
{
zval *exception_handler;
- zend_string *exception_handler_name = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &exception_handler) == FAILURE) {
return;
}
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, NULL)) {
+ zend_string *exception_handler_name = zend_get_callable_name(exception_handler);
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
get_active_function_name(), exception_handler_name?ZSTR_VAL(exception_handler_name):"unknown");
zend_string_release(exception_handler_name);
return;
}
- zend_string_release(exception_handler_name);
}
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
}
if (!fci_cache || !fci_cache->initialized) {
- zend_string *callable_name;
char *error = NULL;
if (!fci_cache) {
fci_cache = &fci_cache_local;
}
- if (!zend_is_callable_ex(&fci->function_name, fci->object, IS_CALLABLE_CHECK_SILENT, &callable_name, fci_cache, &error)) {
+ if (!zend_is_callable_ex(&fci->function_name, fci->object, IS_CALLABLE_CHECK_SILENT, NULL, fci_cache, &error)) {
if (error) {
+ zend_string *callable_name
+ = zend_get_callable_name_ex(&fci->function_name, fci->object);
zend_error(E_WARNING, "Invalid callback %s, %s", ZSTR_VAL(callable_name), error);
efree(error);
- }
- if (callable_name) {
zend_string_release(callable_name);
}
if (EG(current_execute_data) == &dummy_execute_data) {
zend_error(E_DEPRECATED, "%s", error);
efree(error);
if (UNEXPECTED(EG(exception))) {
- if (callable_name) {
- zend_string_release(callable_name);
- }
if (EG(current_execute_data) == &dummy_execute_data) {
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
}
return FAILURE;
}
}
- zend_string_release(callable_name);
}
func = fci_cache->function_handler;
* link resource id (int) as arguments. The value returned from the function is
* used to determine if the event handler should remain set.
*/
- zend_string *cb_name;
zval *args, *cb_arg;
ibase_db_link *ib_link;
ibase_event *event;
}
/* get the callback */
- if (!zend_is_callable(cb_arg, 0, &cb_name)) {
+ if (!zend_is_callable(cb_arg, 0, NULL)) {
+ zend_string *cb_name = zend_get_callable_name(cb_arg);
_php_ibase_module_error("Callback argument %s is not a callable function", ZSTR_VAL(cb_name));
zend_string_release(cb_name);
RETURN_FALSE;
}
- zend_string_release(cb_name);
/* allocate the event resource */
event = (ibase_event *) safe_emalloc(sizeof(ibase_event), 1, 0);
{
zval *link, *callback;
ldap_linkdata *ld;
- zend_string *callback_name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &link, &callback) != SUCCESS) {
RETURN_FALSE;
}
/* callable? */
- if (!zend_is_callable(callback, 0, &callback_name)) {
+ if (!zend_is_callable(callback, 0, NULL)) {
+ zend_string *callback_name = zend_get_callable_name(callback);
php_error_docref(NULL, E_WARNING, "Two arguments expected for '%s' to be a valid callback", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
RETURN_FALSE;
}
- zend_string_release(callback_name);
/* register rebind procedure */
if (Z_ISUNDEF(ld->rebindproc)) {
zval *z_connection;
php_oci_connection *connection;
zval *callback;
- zend_string *callback_name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!", &z_connection, &callback) == FAILURE) {
return;
}
if (callback) {
- if (!zend_is_callable(callback, 0, &callback_name)) {
+ if (!zend_is_callable(callback, 0, NULL)) {
+ zend_string *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;
}
-
- zend_string_release(callback_name);
}
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
PHP_FUNCTION(pcntl_signal)
{
zval *handle;
- zend_string *func_name;
zend_long signo;
zend_bool restart_syscalls = 1;
RETURN_TRUE;
}
- if (!zend_is_callable(handle, 0, &func_name)) {
+ if (!zend_is_callable(handle, 0, NULL)) {
+ zend_string *func_name = zend_get_callable_name(handle);
PCNTL_G(last_error) = EINVAL;
php_error_docref(NULL, E_WARNING, "%s is not a callable function name error", ZSTR_VAL(func_name));
zend_string_release(func_name);
RETURN_FALSE;
}
- zend_string_release(func_name);
/* Add the function name to our signal table */
if (zend_hash_index_update(&PCNTL_G(php_signal_table), signo, handle)) {
{
zval *regex, *replace, *subject, *zcount = NULL;
zend_long limit = -1;
- zend_string *callback_name;
int replace_count;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
Z_PARAM_ZVAL_DEREF(zcount)
ZEND_PARSE_PARAMETERS_END();
- if (!zend_is_callable_ex(replace, NULL, 0, &callback_name, &fcc, NULL)) {
+ if (!zend_is_callable_ex(replace, NULL, 0, NULL, &fcc, NULL)) {
+ zend_string *callback_name = zend_get_callable_name(replace);
php_error_docref(NULL, E_WARNING, "Requires argument 2, '%s', to be a valid callback", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
ZVAL_STR(return_value, zval_get_string(subject));
return;
}
- zend_string_release(callback_name);
fci.size = sizeof(fci);
fci.object = NULL;
zval regex, zv, *replace, *subject, *pattern, *zcount = NULL;
zend_long limit = -1;
zend_string *str_idx;
- zend_string *callback_name;
int replace_count = 0;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
RETURN_NULL();
}
- if (!zend_is_callable_ex(replace, NULL, 0, &callback_name, &fcc, NULL)) {
+ if (!zend_is_callable_ex(replace, NULL, 0, NULL, &fcc, NULL)) {
+ zend_string *callback_name = zend_get_callable_name(replace);
php_error_docref(NULL, E_WARNING, "'%s' is not a valid callback", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
zval_ptr_dtor(®ex);
ZVAL_COPY(return_value, subject);
return;
}
- zend_string_release(callback_name);
ZVAL_COPY_VALUE(&fci.function_name, replace);
size_t func_name_len;
zend_long argc = -1;
zend_long flags = 0;
- zend_string *cbname = NULL;
pdo_dbh_t *dbh;
pdo_sqlite_db_handle *H;
int ret;
dbh = Z_PDO_DBH_P(getThis());
PDO_CONSTRUCT_CHECK;
- if (!zend_is_callable(callback, 0, &cbname)) {
+ if (!zend_is_callable(callback, 0, NULL)) {
+ zend_string *cbname = zend_get_callable_name(callback);
php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname));
zend_string_release(cbname);
RETURN_FALSE;
}
- zend_string_release(cbname);
H = (pdo_sqlite_db_handle *)dbh->driver_data;
char *func_name;
size_t func_name_len;
zend_long argc = -1;
- zend_string *cbname = NULL;
pdo_dbh_t *dbh;
pdo_sqlite_db_handle *H;
int ret;
dbh = Z_PDO_DBH_P(getThis());
PDO_CONSTRUCT_CHECK;
- if (!zend_is_callable(step_callback, 0, &cbname)) {
+ if (!zend_is_callable(step_callback, 0, NULL)) {
+ zend_string *cbname = zend_get_callable_name(step_callback);
php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname));
zend_string_release(cbname);
RETURN_FALSE;
}
- zend_string_release(cbname);
- if (!zend_is_callable(fini_callback, 0, &cbname)) {
+
+ if (!zend_is_callable(fini_callback, 0, NULL)) {
+ zend_string *cbname = zend_get_callable_name(fini_callback);
php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname));
zend_string_release(cbname);
RETURN_FALSE;
}
- zend_string_release(cbname);
H = (pdo_sqlite_db_handle *)dbh->driver_data;
zval *callback;
char *collation_name;
size_t collation_name_len;
- zend_string *cbname = NULL;
pdo_dbh_t *dbh;
pdo_sqlite_db_handle *H;
int ret;
dbh = Z_PDO_DBH_P(getThis());
PDO_CONSTRUCT_CHECK;
- if (!zend_is_callable(callback, 0, &cbname)) {
+ if (!zend_is_callable(callback, 0, NULL)) {
+ zend_string *cbname = zend_get_callable_name(callback);
php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname));
zend_string_release(cbname);
RETURN_FALSE;
}
- zend_string_release(cbname);
H = (pdo_sqlite_db_handle *)dbh->driver_data;
return NULL;
}
matches[0] = strdup("");
- matches[1] = '\0';
+ matches[1] = NULL;
}
}
}
PHP_FUNCTION(readline_completion_function)
{
- zval *arg = NULL;
- zend_string *name = NULL;
+ zval *arg;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg)) {
RETURN_FALSE;
}
- if (!zend_is_callable(arg, 0, &name)) {
+ if (!zend_is_callable(arg, 0, NULL)) {
+ zend_string *name = zend_get_callable_name(arg);
php_error_docref(NULL, E_WARNING, "%s is not callable", ZSTR_VAL(name));
zend_string_release(name);
RETURN_FALSE;
}
- zend_string_release(name);
zval_ptr_dtor(&_readline_completion);
ZVAL_COPY(&_readline_completion, arg);
PHP_FUNCTION(readline_callback_handler_install)
{
zval *callback;
- zend_string *name = NULL;
char *prompt;
size_t prompt_len;
return;
}
- if (!zend_is_callable(callback, 0, &name)) {
+ if (!zend_is_callable(callback, 0, NULL)) {
+ zend_string *name = zend_get_callable_name(callback);
php_error_docref(NULL, E_WARNING, "%s is not callable", ZSTR_VAL(name));
zend_string_release(name);
RETURN_FALSE;
}
- zend_string_release(name);
if (Z_TYPE(_prepped_callback) != IS_UNDEF) {
rl_callback_handler_remove();
{
zval *args = NULL;
int i, num_args, argc = ZEND_NUM_ARGS();
- zend_string *name;
zend_string *ini_name, *ini_val;
if (PS(session_status) == php_session_active) {
/* At this point argc can only be between 6 and PS_NUM_APIS */
for (i = 0; i < argc; i++) {
- if (!zend_is_callable(&args[i], 0, &name)) {
+ if (!zend_is_callable(&args[i], 0, NULL)) {
+ zend_string *name = zend_get_callable_name(&args[i]);
php_error_docref(NULL, E_WARNING, "Argument %d is not a valid callback", i+1);
zend_string_release(name);
RETURN_FALSE;
}
- zend_string_release(name);
}
if (PS(mod) && PS(mod) != &ps_mod_user) {
char *sql_func;
size_t sql_func_len;
zval *callback_func;
- zend_string *callback_name;
zend_long sql_func_num_args = -1;
zend_long flags = 0;
db_obj = Z_SQLITE3_DB_P(object);
RETURN_FALSE;
}
- if (!zend_is_callable(callback_func, 0, &callback_name)) {
+ if (!zend_is_callable(callback_func, 0, NULL)) {
+ zend_string *callback_name = zend_get_callable_name(callback_func);
php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
RETURN_FALSE;
}
- zend_string_release(callback_name);
func = (php_sqlite3_func *)ecalloc(1, sizeof(*func));
zval *object = getThis();
php_sqlite3_func *func;
char *sql_func;
- zend_string *callback_name;
size_t sql_func_len;
zval *step_callback, *fini_callback;
zend_long sql_func_num_args = -1;
RETURN_FALSE;
}
- if (!zend_is_callable(step_callback, 0, &callback_name)) {
+ if (!zend_is_callable(step_callback, 0, NULL)) {
+ zend_string *callback_name = zend_get_callable_name(step_callback);
php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
RETURN_FALSE;
}
- zend_string_release(callback_name);
- if (!zend_is_callable(fini_callback, 0, &callback_name)) {
+ if (!zend_is_callable(fini_callback, 0, NULL)) {
+ zend_string *callback_name = zend_get_callable_name(fini_callback);
php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
RETURN_FALSE;
}
- zend_string_release(callback_name);
func = (php_sqlite3_func *)ecalloc(1, sizeof(*func));
zval *object = getThis();
php_sqlite3_collation *collation;
char *collation_name;
- zend_string *callback_name;
size_t collation_name_len;
zval *callback_func;
db_obj = Z_SQLITE3_DB_P(object);
RETURN_FALSE;
}
- if (!zend_is_callable(callback_func, 0, &callback_name)) {
+ if (!zend_is_callable(callback_func, 0, NULL)) {
+ zend_string *callback_name = zend_get_callable_name(callback_func);
php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
RETURN_FALSE;
}
- zend_string_release(callback_name);
collation = (php_sqlite3_collation *)ecalloc(1, sizeof(*collation));
if (sqlite3_create_collation(db_obj->db, collation_name, SQLITE_UTF8, collation, php_sqlite3_callback_compare) == SQLITE_OK) {
{
php_shutdown_function_entry *shutdown_function_entry = Z_PTR_P(zv);
zval retval;
- zend_string *function_name;
- if (!zend_is_callable(&shutdown_function_entry->arguments[0], 0, &function_name)) {
- if (function_name) {
- php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", ZSTR_VAL(function_name));
- zend_string_release(function_name);
- } else {
- php_error(E_WARNING, "(Registered shutdown functions) Unable to call - function does not exist");
- }
- return 0;
- }
- if (function_name) {
+ if (!zend_is_callable(&shutdown_function_entry->arguments[0], 0, NULL)) {
+ zend_string *function_name
+ = zend_get_callable_name(&shutdown_function_entry->arguments[0]);
+ php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", ZSTR_VAL(function_name));
zend_string_release(function_name);
+ return 0;
}
if (call_user_function(EG(function_table), NULL,
PHP_FUNCTION(register_shutdown_function)
{
php_shutdown_function_entry shutdown_function_entry;
- zend_string *callback_name = NULL;
int i;
shutdown_function_entry.arg_count = ZEND_NUM_ARGS();
}
/* Prevent entering of anything but valid callback (syntax check only!) */
- if (!zend_is_callable(&shutdown_function_entry.arguments[0], 0, &callback_name)) {
- if (callback_name) {
- php_error_docref(NULL, E_WARNING, "Invalid shutdown callback '%s' passed", ZSTR_VAL(callback_name));
- } else {
- php_error_docref(NULL, E_WARNING, "Invalid shutdown callback passed");
- }
+ if (!zend_is_callable(&shutdown_function_entry.arguments[0], 0, NULL)) {
+ zend_string *callback_name
+ = zend_get_callable_name(&shutdown_function_entry.arguments[0]);
+ php_error_docref(NULL, E_WARNING, "Invalid shutdown callback '%s' passed", ZSTR_VAL(callback_name));
efree(shutdown_function_entry.arguments);
+ zend_string_release(callback_name);
RETVAL_FALSE;
} else {
if (!BG(user_shutdown_function_names)) {
}
zend_hash_next_index_insert_mem(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry));
}
- if (callback_name) {
- zend_string_release(callback_name);
- }
}
/* }}} */