summaryrefslogtreecommitdiff
path: root/Zend/zend.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-03-09 13:57:15 +0100
committerNikita Popov <nikic@php.net>2015-03-09 14:01:32 +0100
commit1c94ff0595bbe6f3df8058aff7252bda09dc4a15 (patch)
treeefe488bc3292d544657fca92c4347c9b872931eb /Zend/zend.c
parent2f156c61f19a889c8ed39fe8eb3b3220555db647 (diff)
downloadphp-git-1c94ff0595bbe6f3df8058aff7252bda09dc4a15.tar.gz
Implement engine exceptions
RFC: https://wiki.php.net/rfc/engine_exceptions_for_php7 Pending changes regarding naming of BaseException and whether it should be an interface.
Diffstat (limited to 'Zend/zend.c')
-rw-r--r--Zend/zend.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 8d6cd7148f..fe507d7154 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -842,7 +842,7 @@ void zend_set_utility_values(zend_utility_values *utility_values) /* {{{ */
/* this should be compatible with the standard zenderror */
void zenderror(const char *error) /* {{{ */
{
- zend_error(E_PARSE, "%s", error);
+ zend_throw_exception(zend_get_parse_exception(), error, E_PARSE);
}
/* }}} */
@@ -1016,6 +1016,21 @@ static void zend_error_va_list(int type, const char *format, va_list args)
zend_stack context_stack;
zend_array *symbol_table;
+ if (type & E_EXCEPTION) {
+ char *message = NULL;
+
+#if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
+ va_start(args, format);
+#endif
+ zend_vspprintf(&message, 0, format, args);
+ zend_throw_exception(zend_get_engine_exception(), message, type & ~E_EXCEPTION);
+ efree(message);
+#if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
+ va_end(args);
+#endif
+ return;
+ }
+
/* Report about uncaught exception in case of fatal errors */
if (EG(exception)) {
zend_execute_data *ex;