Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 0 additions & 72 deletions Zend/zend_constants.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,78 +411,6 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
zend_string_release_ex(class_name, 0);
zend_string_efree(constant_name);
return ret_constant;
/*
zend_class_entry *ce = NULL;
zend_class_constant *c = NULL;
zval *ret_constant = NULL;

if (zend_string_equals_literal_ci(class_name, "self")) {
if (UNEXPECTED(!scope)) {
zend_throw_error(NULL, "Cannot access \"self\" when no class scope is active");
goto failure;
}
ce = scope;
} else if (zend_string_equals_literal_ci(class_name, "parent")) {
if (UNEXPECTED(!scope)) {
zend_throw_error(NULL, "Cannot access \"parent\" when no class scope is active");
goto failure;
} else if (UNEXPECTED(!scope->parent)) {
zend_throw_error(NULL, "Cannot access \"parent\" when current class scope has no parent");
goto failure;
} else {
ce = scope->parent;
}
} else if (zend_string_equals_ci(class_name, ZSTR_KNOWN(ZEND_STR_STATIC))) {
ce = zend_get_called_scope(EG(current_execute_data));
if (UNEXPECTED(!ce)) {
zend_throw_error(NULL, "Cannot access \"static\" when no class scope is active");
goto failure;
}
} else {
ce = zend_fetch_class(class_name, flags);
}
if (ce) {
c = zend_hash_find_ptr(CE_CONSTANTS_TABLE(ce), constant_name);
if (c == NULL) {
if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {
zend_throw_error(NULL, "Undefined constant %s::%s", ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
goto failure;
}
ret_constant = NULL;
} else {
if (!zend_verify_const_access(c, scope)) {
if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {
zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
}
goto failure;
}
ret_constant = &c->value;
}
}

if (ret_constant && Z_TYPE_P(ret_constant) == IS_CONSTANT_AST) {
zend_result ret;

if (IS_CONSTANT_VISITED(ret_constant)) {
zend_throw_error(NULL, "Cannot declare self-referencing constant %s::%s", ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
ret_constant = NULL;
goto failure;
}

MARK_CONSTANT_VISITED(ret_constant);
ret = zval_update_constant_ex(ret_constant, c->ce);
RESET_CONSTANT_VISITED(ret_constant);

if (UNEXPECTED(ret != SUCCESS)) {
ret_constant = NULL;
goto failure;
}
}
failure:
zend_string_release_ex(class_name, 0);
zend_string_efree(constant_name);
return ret_constant;
*/
}

/* non-class constant */
Expand Down