helly Fri Jan 2 13:14:17 2009 UTC Modified files: /ZendEngine2 zend.c zend_execute_API.c zend_exceptions.c zend_exceptions.h /php-src/sapi/cli php_cli.c Log: - Catch exceptions in cli -a http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.c?r1=1.427&r2=1.428&diff_format=u Index: ZendEngine2/zend.c diff -u ZendEngine2/zend.c:1.427 ZendEngine2/zend.c:1.428 --- ZendEngine2/zend.c:1.427 Wed Dec 31 12:24:56 2008 +++ ZendEngine2/zend.c Fri Jan 2 13:14:16 2009 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.c,v 1.427 2008/12/31 12:24:56 helly Exp $ */ +/* $Id: zend.c,v 1.428 2009/01/02 13:14:16 helly Exp $ */ #include "zend.h" #include "zend_extensions.h" @@ -1728,10 +1728,10 @@ } } else { zend_exception_restore(TSRMLS_C); - zend_exception_error(EG(exception) TSRMLS_CC); + zend_exception_error(EG(exception), E_ERROR TSRMLS_CC); } } else { - zend_exception_error(EG(exception) TSRMLS_CC); + zend_exception_error(EG(exception), E_ERROR TSRMLS_CC); } } destroy_op_array(EG(active_op_array) TSRMLS_CC); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.470&r2=1.471&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.470 ZendEngine2/zend_execute_API.c:1.471 --- ZendEngine2/zend_execute_API.c:1.470 Wed Dec 31 11:12:29 2008 +++ ZendEngine2/zend_execute_API.c Fri Jan 2 13:14:17 2009 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.470 2008/12/31 11:12:29 sebastian Exp $ */ +/* $Id: zend_execute_API.c,v 1.471 2009/01/02 13:14:17 helly Exp $ */ #include <stdio.h> #include <signal.h> @@ -1312,7 +1312,7 @@ result = zend_u_eval_string(type, str, retval_ptr, string_name TSRMLS_CC); if (handle_exceptions && EG(exception)) { - zend_exception_error(EG(exception) TSRMLS_CC); + zend_exception_error(EG(exception), E_ERROR TSRMLS_CC); result = FAILURE; } return result; @@ -1387,7 +1387,7 @@ zend_execute(CG(active_op_array) TSRMLS_CC); if (EG(exception)) { - zend_exception_error(EG(exception) TSRMLS_CC); + zend_exception_error(EG(exception), E_ERROR TSRMLS_CC); } CG(active_op_array)->last -= 1; /* get rid of that ZEND_RETURN */ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_exceptions.c?r1=1.131&r2=1.132&diff_format=u Index: ZendEngine2/zend_exceptions.c diff -u ZendEngine2/zend_exceptions.c:1.131 ZendEngine2/zend_exceptions.c:1.132 --- ZendEngine2/zend_exceptions.c:1.131 Wed Dec 31 11:12:28 2008 +++ ZendEngine2/zend_exceptions.c Fri Jan 2 13:14:17 2009 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_exceptions.c,v 1.131 2008/12/31 11:12:28 sebastian Exp $ */ +/* $Id: zend_exceptions.c,v 1.132 2009/01/02 13:14:17 helly Exp $ */ #include "zend.h" #include "zend_API.h" @@ -817,8 +817,8 @@ } /* }}} */ -/* This function doesn't return as it calls E_ERROR */ -ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) /* {{{ */ +/* This function doesn't return if it uses E_ERROR */ +ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {{{ */ { zend_class_entry *ce_exception = Z_OBJCE_P(exception); if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) { @@ -861,10 +861,10 @@ zend_error_va(E_ERROR, Z_STRVAL(copy), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str)); zval_dtor(©); } else { - zend_error_va(E_ERROR, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str)); + zend_error_va(severity, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str)); } } else { - zend_error(E_ERROR, "Uncaught exception '%v'", ce_exception->name); + zend_error(severity, "Uncaught exception '%v'", ce_exception->name); } } /* }}} */ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_exceptions.h?r1=1.32&r2=1.33&diff_format=u Index: ZendEngine2/zend_exceptions.h diff -u ZendEngine2/zend_exceptions.h:1.32 ZendEngine2/zend_exceptions.h:1.33 --- ZendEngine2/zend_exceptions.h:1.32 Wed Dec 31 11:12:28 2008 +++ ZendEngine2/zend_exceptions.h Fri Jan 2 13:14:17 2009 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_exceptions.h,v 1.32 2008/12/31 11:12:28 sebastian Exp $ */ +/* $Id: zend_exceptions.h,v 1.33 2009/01/02 13:14:17 helly Exp $ */ #ifndef ZEND_EXCEPTIONS_H #define ZEND_EXCEPTIONS_H @@ -49,8 +49,8 @@ extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); -/* show an exception using zend_error(E_ERROR,...) */ -ZEND_API void zend_exception_error(zval *exception TSRMLS_DC); +/* show an exception using zend_error(severity,...), severity should be E_ERROR */ +ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC); /* do not export, in php it's available thru spprintf directly */ int zend_spprintf(char **message, int max_len, char *format, ...); http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/php_cli.c?r1=1.203&r2=1.204&diff_format=u Index: php-src/sapi/cli/php_cli.c diff -u php-src/sapi/cli/php_cli.c:1.203 php-src/sapi/cli/php_cli.c:1.204 --- php-src/sapi/cli/php_cli.c:1.203 Wed Dec 31 14:15:41 2008 +++ php-src/sapi/cli/php_cli.c Fri Jan 2 13:14:17 2009 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_cli.c,v 1.203 2008/12/31 14:15:41 helly Exp $ */ +/* $Id: php_cli.c,v 1.204 2009/01/02 13:14:17 helly Exp $ */ #include "php.h" #include "php_globals.h" @@ -1127,7 +1127,7 @@ } if (EG(exception)) { - zend_exception_error(EG(exception) TSRMLS_CC); + zend_exception_error(EG(exception), E_WARNING TSRMLS_CC); } php_last_char = '\0';
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php