Skip to content

Commit

Permalink
implement semi-reserved grammar for object declaration and access con…
Browse files Browse the repository at this point in the history
…texts
  • Loading branch information
marcioAlmada committed Feb 11, 2015
1 parent ad0e776 commit d9d6f0c
Show file tree
Hide file tree
Showing 4 changed files with 3,294 additions and 2,876 deletions.
6 changes: 6 additions & 0 deletions Zend/zend_compile.c
Expand Up @@ -4404,6 +4404,12 @@ void zend_compile_class_const_decl(zend_ast *ast) /* {{{ */
zend_const_expr_to_zval(&value_zv, value_ast);

name = zend_new_interned_string_safe(name);

if (zend_string_equals_literal_ci(name, "class")) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot redefine %s::%s, ::%s is reserved",
ce->name->val, name->val, name->val);
}

if (zend_hash_add(&ce->constants_table, name, &value_zv) == NULL) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot redefine class constant %s::%s",
ce->name->val, name->val);
Expand Down

0 comments on commit d9d6f0c

Please sign in to comment.