summaryrefslogtreecommitdiff
path: root/Zend/zend_inheritance.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-10-10 10:11:05 +0300
committerDmitry Stogov <dmitry@zend.com>2017-10-10 10:11:05 +0300
commitef5ea48741a1d227a10a6654c1a8cc2f02dd414f (patch)
treeb00f4e9dd2ea42355c860a0ea57a0d9f4b926091 /Zend/zend_inheritance.c
parent08c0998b1ff1fa1a105eda1540a90ddb8ee4b16a (diff)
downloadphp-git-ef5ea48741a1d227a10a6654c1a8cc2f02dd414f.tar.gz
Always use IS_CONSTANT_AST (IS_CONSTANT is removed).
Diffstat (limited to 'Zend/zend_inheritance.c')
-rw-r--r--Zend/zend_inheritance.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 3e57343c4c..b607efa5c9 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -497,9 +497,7 @@ static ZEND_COLD zend_string *zend_get_function_declaration(const zend_function
if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type != IS_UNUSED) {
zval *zv = RT_CONSTANT(precv, precv->op2);
- if (Z_TYPE_P(zv) == IS_CONSTANT) {
- smart_str_append(&str, Z_STR_P(zv));
- } else if (Z_TYPE_P(zv) == IS_FALSE) {
+ if (Z_TYPE_P(zv) == IS_FALSE) {
smart_str_appends(&str, "false");
} else if (Z_TYPE_P(zv) == IS_TRUE) {
smart_str_appends(&str, "true");
@@ -515,7 +513,12 @@ static ZEND_COLD zend_string *zend_get_function_declaration(const zend_function
} else if (Z_TYPE_P(zv) == IS_ARRAY) {
smart_str_appends(&str, "Array");
} else if (Z_TYPE_P(zv) == IS_CONSTANT_AST) {
- smart_str_appends(&str, "<expression>");
+ zend_ast *ast = Z_ASTVAL_P(zv);
+ if (ast->kind == ZEND_AST_CONSTANT) {
+ smart_str_append(&str, zend_ast_get_constant_name(ast));
+ } else {
+ smart_str_appends(&str, "<expression>");
+ }
} else {
zend_string *zv_str = zval_get_string(zv);
smart_str_append(&str, zv_str);
@@ -769,7 +772,7 @@ static void do_inherit_class_constant(zend_string *name, zend_class_constant *pa
ZSTR_VAL(ce->name), ZSTR_VAL(name), zend_visibility_string(Z_ACCESS_FLAGS(parent_const->value)), ZSTR_VAL(ce->parent->name), (Z_ACCESS_FLAGS(parent_const->value) & ZEND_ACC_PUBLIC) ? "" : " or weaker");
}
} else if (!(Z_ACCESS_FLAGS(parent_const->value) & ZEND_ACC_PRIVATE)) {
- if (Z_CONSTANT(parent_const->value)) {
+ if (Z_TYPE(parent_const->value) == IS_CONSTANT_AST) {
ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
}
if (ce->type & ZEND_INTERNAL_CLASS) {
@@ -845,7 +848,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
#ifdef ZTS
if (parent_ce->type != ce->type) {
ZVAL_DUP(dst, src);
- if (Z_OPT_CONSTANT_P(dst)) {
+ if (Z_OPT_TYPE_P(dst) == IS_CONSTANT_AST) {
ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
}
continue;
@@ -853,7 +856,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
#endif
ZVAL_COPY(dst, src);
- if (Z_OPT_CONSTANT_P(dst)) {
+ if (Z_OPT_TYPE_P(dst) == IS_CONSTANT_AST) {
ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
}
} while (dst != end);
@@ -894,7 +897,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
}
ZVAL_COPY_VALUE(dst, src);
Z_ADDREF_P(dst);
- if (Z_CONSTANT_P(Z_REFVAL_P(dst))) {
+ if (Z_TYPE_P(Z_REFVAL_P(dst)) == IS_CONSTANT_AST) {
ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
}
} while (dst != end);
@@ -982,7 +985,7 @@ static void do_inherit_iface_constant(zend_string *name, zend_class_constant *c,
{
if (do_inherit_constant_check(&ce->constants_table, c, name, iface)) {
zend_class_constant *ct;
- if (Z_CONSTANT(c->value)) {
+ if (Z_TYPE(c->value) == IS_CONSTANT_AST) {
ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
}
if (ce->type & ZEND_INTERNAL_CLASS) {