/* {{{ Sets a user-defined error handler function. Returns the previously defined error handler, or false on error */
ZEND_FUNCTION(set_error_handler)
{
- zval *error_handler;
+ zend_fcall_info fci;
+ zend_fcall_info_cache fcc;
zend_long error_type = E_ALL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &error_handler, &error_type) == FAILURE) {
+ /* callable argument corresponds to the error handler */
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "f!|l", &fci, &fcc, &error_type) == FAILURE) {
RETURN_THROWS();
}
- if (Z_TYPE_P(error_handler) != IS_NULL) { /* NULL == unset */
- if (!zend_is_callable(error_handler, 0, NULL)) {
- zend_string *error_handler_name = zend_get_callable_name(error_handler);
- zend_argument_type_error(1, "must be a valid callback");
- zend_string_release_ex(error_handler_name, 0);
- RETURN_THROWS();
- }
- }
-
if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
ZVAL_COPY(return_value, &EG(user_error_handler));
}
zend_stack_push(&EG(user_error_handlers_error_reporting), &EG(user_error_handler_error_reporting));
zend_stack_push(&EG(user_error_handlers), &EG(user_error_handler));
- if (Z_TYPE_P(error_handler) == IS_NULL) { /* unset user-defined handler */
+ if (!ZEND_FCI_INITIALIZED(fci)) { /* unset user-defined handler */
ZVAL_UNDEF(&EG(user_error_handler));
return;
}
- ZVAL_COPY(&EG(user_error_handler), error_handler);
+ ZVAL_COPY(&EG(user_error_handler), &(fci.function_name));
EG(user_error_handler_error_reporting) = (int)error_type;
}
/* }}} */
/* {{{ Sets a user-defined exception handler function. Returns the previously defined exception handler, or false on error */
ZEND_FUNCTION(set_exception_handler)
{
- zval *exception_handler;
+ zend_fcall_info fci;
+ zend_fcall_info_cache fcc;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &exception_handler) == FAILURE) {
+ /* callable argument corresponds to the exception handler */
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "f!", &fci, &fcc) == FAILURE) {
RETURN_THROWS();
}
- if (Z_TYPE_P(exception_handler) != IS_NULL) { /* NULL == unset */
- if (!zend_is_callable(exception_handler, 0, NULL)) {
- zend_string *exception_handler_name = zend_get_callable_name(exception_handler);
- zend_argument_type_error(1, "must be a valid callback");
- zend_string_release_ex(exception_handler_name, 0);
- RETURN_THROWS();
- }
- }
-
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
ZVAL_COPY(return_value, &EG(user_exception_handler));
}
zend_stack_push(&EG(user_exception_handlers), &EG(user_exception_handler));
- if (Z_TYPE_P(exception_handler) == IS_NULL) { /* unset user-defined handler */
+ if (!ZEND_FCI_INITIALIZED(fci)) { /* unset user-defined handler */
ZVAL_UNDEF(&EG(user_exception_handler));
return;
}
- ZVAL_COPY(&EG(user_exception_handler), exception_handler);
+ ZVAL_COPY(&EG(user_exception_handler), &(fci.function_name));
}
/* }}} */
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: f81f2b4cf552c4ee8406b91c437797feb1164be0 */
+ * Stub hash: 0d3c035fc2b9f0dcdbf6efe3c740d8aa3805ec32 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_version, 0, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_user_error arginfo_trigger_error
ZEND_BEGIN_ARG_INFO_EX(arginfo_set_error_handler, 0, 0, 1)
- ZEND_ARG_INFO(0, error_handler)
+ ZEND_ARG_TYPE_INFO(0, error_handler, IS_CALLABLE, 1)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, error_types, IS_LONG, 0, "E_ALL")
ZEND_END_ARG_INFO()
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_set_exception_handler, 0, 0, 1)
- ZEND_ARG_INFO(0, exception_handler)
+ ZEND_ARG_TYPE_INFO(0, exception_handler, IS_CALLABLE, 1)
ZEND_END_ARG_INFO()
#define arginfo_restore_exception_handler arginfo_restore_error_handler