Index: ext/standard/basic_functions.c =================================================================== RCS file: /repository/php-src/ext/standard/basic_functions.c,v retrieving revision 1.725.2.31.2.16 diff -u -p -d -r1.725.2.31.2.16 basic_functions.c --- ext/standard/basic_functions.c 15 Jul 2006 10:21:09 -0000 1.725.2.31.2.16 +++ ext/standard/basic_functions.c 17 Jul 2006 10:04:33 -0000 @@ -774,6 +774,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_error_log 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) ZEND_ARG_INFO(0, parmeter) @@ -3357,6 +3361,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) @@ -4957,6 +4962,29 @@ PHPAPI int _php_error_log(int opt_err, c return SUCCESS; } +/* {{{ proto object error_get_last() + Get the last occurred error */ +PHP_FUNCTION(error_get_last) +{ + if (ZEND_NUM_ARGS()) { + WRONG_PARAM_COUNT; + } + object_init(return_value); + add_property_long_ex(return_value, "type", sizeof("type"), PG(last_error_type) TSRMLS_CC); + if (PG(last_error_message)) { + add_property_string_ex(return_value, "message", sizeof("message"), PG(last_error_message), 1 TSRMLS_CC); + } else { + add_property_null_ex(return_value, "message", sizeof("message") TSRMLS_CC); + } + if (PG(last_error_file)) { + add_property_string_ex(return_value, "file", sizeof("file"), PG(last_error_file), 1 TSRMLS_CC); + } else { + add_property_null_ex(return_value, "file", sizeof("file") TSRMLS_CC); + } + add_property_long_ex(return_value, "line", sizeof("line"), PG(last_error_lineno) TSRMLS_CC); +} +/* }}} */ + /* {{{ 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) Index: ext/standard/basic_functions.h =================================================================== RCS file: /repository/php-src/ext/standard/basic_functions.h,v retrieving revision 1.139.2.4.2.1 diff -u -p -d -r1.139.2.4.2.1 basic_functions.h --- ext/standard/basic_functions.h 14 May 2006 16:06:48 -0000 1.139.2.4.2.1 +++ ext/standard/basic_functions.h 17 Jul 2006 10:04:34 -0000 @@ -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); Index: main/main.c =================================================================== RCS file: /repository/php-src/main/main.c,v retrieving revision 1.640.2.23.2.10 diff -u -p -d -r1.640.2.23.2.10 main.c --- main/main.c 17 Jul 2006 07:20:12 -0000 1.640.2.23.2.10 +++ main/main.c 17 Jul 2006 10:04:52 -0000 @@ -683,6 +683,7 @@ static void php_error_cb(int type, const 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; Index: main/php_globals.h =================================================================== RCS file: /repository/php-src/main/php_globals.h,v retrieving revision 1.98.2.1.2.1 diff -u -p -d -r1.98.2.1.2.1 php_globals.h --- main/php_globals.h 16 Jun 2006 14:09:01 -0000 1.98.2.1.2.1 +++ main/php_globals.h 17 Jul 2006 10:04:52 -0000 @@ -142,6 +142,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;