Browse Source

- added error_get_last() function

migration/RELEASE_1_0_0
Michael Wallner 20 years ago
parent
commit
73ba3e2592
  1. 22
      ext/standard/basic_functions.c
  2. 1
      ext/standard/basic_functions.h
  3. 1
      main/main.c
  4. 1
      main/php_globals.h

22
ext/standard/basic_functions.c

@ -771,6 +771,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_error_log, 0, 0, 1)
ZEND_ARG_INFO(0, extra_headers)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_error_get_last, 0, 0, 0)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_func, 0, 0, 1)
ZEND_ARG_INFO(0, function_name)
@ -3389,6 +3393,7 @@ zend_function_entry basic_functions[] = {
PHP_FE(import_request_variables, arginfo_import_request_variables)
PHP_FE(error_log, arginfo_error_log)
PHP_FE(error_get_last, arginfo_error_get_last)
PHP_FE(call_user_func, arginfo_call_user_func)
PHP_FE(call_user_func_array, arginfo_call_user_func_array)
PHP_DEP_FE(call_user_method, arginfo_call_user_method)
@ -4935,6 +4940,23 @@ PHPAPI char *php_get_current_user()
return SG(request_info).current_user;
}
/* {{{ proto array error_get_last()
Get the last occurred error as associative array. Returns NULL if there hasn't been an error yet. */
PHP_FUNCTION(error_get_last)
{
if (ZEND_NUM_ARGS()) {
WRONG_PARAM_COUNT;
}
if (PG(last_error_message)) {
array_init(return_value);
add_assoc_long_ex(return_value, "type", sizeof("type"), PG(last_error_type));
add_assoc_string_ex(return_value, "message", sizeof("message"), PG(last_error_message), 1);
add_assoc_string_ex(return_value, "file", sizeof("file"), PG(last_error_file)?PG(last_error_file):"-", 1 );
add_assoc_long_ex(return_value, "line", sizeof("line"), PG(last_error_lineno));
}
}
/* }}} */
/* {{{ proto mixed call_user_func(string function_name [, mixed parmeter] [, mixed ...])
Call a user function which is the first parameter */
PHP_FUNCTION(call_user_func)

1
ext/standard/basic_functions.h

@ -79,6 +79,7 @@ PHP_FUNCTION(get_magic_quotes_gpc);
PHP_FUNCTION(import_request_variables);
PHP_FUNCTION(error_log);
PHP_FUNCTION(error_get_last);
PHP_FUNCTION(call_user_func);
PHP_FUNCTION(call_user_func_array);

1
main/main.c

@ -789,6 +789,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
if (PG(last_error_file)) {
free(PG(last_error_file));
}
PG(last_error_type) = type;
PG(last_error_message) = strdup(buffer);
PG(last_error_file) = strdup(error_filename);
PG(last_error_lineno) = error_lineno;

1
main/php_globals.h

@ -128,6 +128,7 @@ struct _php_core_globals {
zend_bool always_populate_raw_post_data;
zend_bool report_zend_debug;
int last_error_type;
char *last_error_message;
char *last_error_file;
int last_error_lineno;

Loading…
Cancel
Save