summaryrefslogtreecommitdiff
path: root/Zend/zend_constants.c
diff options
context:
space:
mode:
authorAaron Piotrowski <aaron@trowski.com>2015-07-03 13:41:17 -0500
committerAaron Piotrowski <aaron@trowski.com>2015-07-03 17:53:40 -0500
commit5a99c07eccb09c3c8b9f6fe4b83020163aad6498 (patch)
tree2405c51d16e14ca24fed2811148220388798b222 /Zend/zend_constants.c
parent866bd89b1d909795bd5ae72121089aef5e0fb204 (diff)
downloadphp-git-5a99c07eccb09c3c8b9f6fe4b83020163aad6498.tar.gz
Enable throwing custom exceptions from errors
Diffstat (limited to 'Zend/zend_constants.c')
-rw-r--r--Zend/zend_constants.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index cde1d7aafb..ec92bfd90c 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -21,6 +21,7 @@
#include "zend.h"
#include "zend_constants.h"
+#include "zend_exceptions.h"
#include "zend_execute.h"
#include "zend_variables.h"
#include "zend_operators.h"
@@ -332,17 +333,17 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
if (class_name_len == sizeof("self")-1 &&
!memcmp(lcname, "self", sizeof("self")-1)) {
if (UNEXPECTED(!scope)) {
- zend_error(E_EXCEPTION | E_ERROR, "Cannot access self:: when no class scope is active");
+ zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access self:: when no class scope is active");
return NULL;
}
ce = scope;
} else if (class_name_len == sizeof("parent")-1 &&
!memcmp(lcname, "parent", sizeof("parent")-1)) {
if (UNEXPECTED(!scope)) {
- zend_error(E_EXCEPTION | E_ERROR, "Cannot access parent:: when no class scope is active");
+ zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access parent:: when no class scope is active");
return NULL;
} else if (UNEXPECTED(!scope->parent)) {
- zend_error(E_EXCEPTION | E_ERROR, "Cannot access parent:: when current class scope has no parent");
+ zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access parent:: when current class scope has no parent");
return NULL;
} else {
ce = scope->parent;
@@ -351,7 +352,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
!memcmp(lcname, "static", sizeof("static")-1)) {
ce = zend_get_called_scope(EG(current_execute_data));
if (UNEXPECTED(!ce)) {
- zend_error(E_EXCEPTION | E_ERROR, "Cannot access static:: when no class scope is active");
+ zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access static:: when no class scope is active");
return NULL;
}
} else {
@@ -362,7 +363,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
ret_constant = zend_hash_find(&ce->constants_table, constant_name);
if (ret_constant == NULL) {
if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {
- zend_error(E_EXCEPTION | E_ERROR, "Undefined class constant '%s::%s'", ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
+ zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined class constant '%s::%s'", ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
zend_string_release(class_name);
zend_string_free(constant_name);
return NULL;