mike Wed Jul 19 12:25:02 2006 UTC
Modified files:
/php-src/ext/standard basic_functions.c basic_functions.h
/php-src/main main.c php_globals.h
Log:
- added error_get_last() function
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.792&r2=1.793&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.792
php-src/ext/standard/basic_functions.c:1.793
--- php-src/ext/standard/basic_functions.c:1.792 Mon Jul 17 20:52:12 2006
+++ php-src/ext/standard/basic_functions.c Wed Jul 19 12:25:02 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.792 2006/07/17 20:52:12 andrei Exp $ */
+/* $Id: basic_functions.c,v 1.793 2006/07/19 12:25:02 mike Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -772,6 +772,10 @@
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)
@@ -3389,6 +3393,7 @@
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 @@
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)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.h?r1=1.147&r2=1.148&diff_format=u
Index: php-src/ext/standard/basic_functions.h
diff -u php-src/ext/standard/basic_functions.h:1.147
php-src/ext/standard/basic_functions.h:1.148
--- php-src/ext/standard/basic_functions.h:1.147 Mon Jul 17 20:52:12 2006
+++ php-src/ext/standard/basic_functions.h Wed Jul 19 12:25:02 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.h,v 1.147 2006/07/17 20:52:12 andrei Exp $ */
+/* $Id: basic_functions.h,v 1.148 2006/07/19 12:25:02 mike Exp $ */
#ifndef BASIC_FUNCTIONS_H
#define BASIC_FUNCTIONS_H
@@ -79,6 +79,7 @@
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);
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.698&r2=1.699&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.698 php-src/main/main.c:1.699
--- php-src/main/main.c:1.698 Tue Jul 18 09:08:06 2006
+++ php-src/main/main.c Wed Jul 19 12:25:02 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.698 2006/07/18 09:08:06 dmitry Exp $ */
+/* $Id: main.c,v 1.699 2006/07/19 12:25:02 mike Exp $ */
/* {{{ includes
*/
@@ -789,6 +789,7 @@
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;
http://cvs.php.net/viewvc.cgi/php-src/main/php_globals.h?r1=1.106&r2=1.107&diff_format=u
Index: php-src/main/php_globals.h
diff -u php-src/main/php_globals.h:1.106 php-src/main/php_globals.h:1.107
--- php-src/main/php_globals.h:1.106 Thu Mar 16 16:53:09 2006
+++ php-src/main/php_globals.h Wed Jul 19 12:25:02 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_globals.h,v 1.106 2006/03/16 16:53:09 dmitry Exp $ */
+/* $Id: php_globals.h,v 1.107 2006/07/19 12:25:02 mike Exp $ */
#ifndef PHP_GLOBALS_H
#define PHP_GLOBALS_H
@@ -128,6 +128,7 @@
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;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php