summaryrefslogtreecommitdiff
path: root/Zend/zend_exceptions.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-04-01 16:17:49 +0300
committerDmitry Stogov <dmitry@zend.com>2016-04-01 16:17:49 +0300
commit7abfaac901684da8bdcbccf43682a5557085c917 (patch)
tree88c9d1a568c3638a070ea21247e8d0213f26d878 /Zend/zend_exceptions.c
parentc72282a13b12b7e572469eba7a7ce593d900a8a2 (diff)
downloadphp-git-7abfaac901684da8bdcbccf43682a5557085c917.tar.gz
Merge zend_execute_data->called_scope into zend_execute_data->This.
"called_scope" made sense only for static method calls, for dynamic calls it was always equal to the class of $this. Now EG(This) may store IS_OBJECT + $this or IS_UNUSED + "called_scope" (of course, "called_scope" may be NULL). Some code might need to be adopted to support this change. Checks (Z_OBJ(EX(This))) might need to be converted into (Z_TYPE(EX(This)) == IS_OBJECT).
Diffstat (limited to 'Zend/zend_exceptions.c')
-rw-r--r--Zend/zend_exceptions.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 21dfdc5146..6d396e7854 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -268,8 +268,10 @@ ZEND_METHOD(exception, __construct)
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, "|SlO!", &message, &code, &previous, zend_ce_throwable) == FAILURE) {
zend_class_entry *ce;
- if (execute_data->called_scope) {
- ce = execute_data->called_scope;
+ if (Z_TYPE(EX(This)) == IS_OBJECT) {
+ ce = Z_OBJCE(EX(This));
+ } else if (Z_CE(EX(This))) {
+ ce = Z_CE(EX(This));
} else {
ce = base_ce;
}
@@ -330,8 +332,10 @@ ZEND_METHOD(error_exception, __construct)
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, "|sllslO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, zend_ce_throwable) == FAILURE) {
zend_class_entry *ce;
- if (execute_data->called_scope) {
- ce = execute_data->called_scope;
+ if (Z_TYPE(EX(This)) == IS_OBJECT) {
+ ce = Z_OBJCE(EX(This));
+ } else if (Z_CE(EX(This))) {
+ ce = Z_CE(EX(This));
} else {
ce = zend_ce_error_exception;
}