Skip to content

Commit 3fd8e14

Browse files
committed
only allow enums and fix test
1 parent 37b6c26 commit 3fd8e14

File tree

4 files changed

+2
-23
lines changed

4 files changed

+2
-23
lines changed

Zend/zend_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1840,7 +1840,7 @@ static zend_always_inline zend_result _object_and_properties_init(zval *arg, zen
18401840
}
18411841

18421842
// preloading may have changed the class type from ZEND_NAMESPACE_CLASS, so we need to check for user/internal class
1843-
if (check_class != scope && check_class->lexical_scope && (check_class->lexical_scope->type != ZEND_USER_CLASS && check_class->lexical_scope->type != ZEND_INTERNAL_CLASS)) {
1843+
if (check_class != scope && check_class->lexical_scope && (check_class->lexical_scope->type == ZEND_USER_CLASS || check_class->lexical_scope->type == ZEND_INTERNAL_CLASS)) {
18441844
check_class = check_class->lexical_scope;
18451845
goto check_lexical_scope;
18461846
}

Zend/zend_language_parser.y

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,6 @@ class_statement_list:
954954
nested_class_statement:
955955
T_CLASS T_STRING { $<num>$ = CG(zend_lineno); } extends_from implements_list backup_doc_comment '{' class_statement_list '}'
956956
{ $$ = zend_ast_create_decl(ZEND_AST_CLASS, 0, $<num>3, $6, zend_ast_get_str($2), $4, $5, $8, NULL, NULL); }
957-
| trait_declaration_statement { $$ = $1; }
958957
| enum_declaration_statement { $$ = $1; }
959958
;
960959

tests/classes/inner_classes/access_modifiers_002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ class Outer {
1010

1111
?>
1212
--EXPECTF--
13-
Parse error: syntax error, unexpected identifier "int", expecting "class" in %s on line %d
13+
Parse error: syntax error, unexpected identifier "int", expecting "class" or "enum" in %s on line %d

tests/classes/inner_classes/trait_001.phpt

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)