diff --git a/Zend/tests/typehints/bug76198.phpt b/Zend/tests/type_declarations/iterable/bug76198.phpt similarity index 100% rename from Zend/tests/typehints/bug76198.phpt rename to Zend/tests/type_declarations/iterable/bug76198.phpt diff --git a/Zend/tests/typehints/bug43332_1.phpt b/Zend/tests/type_declarations/relative_types/bug43332_1.phpt similarity index 86% rename from Zend/tests/typehints/bug43332_1.phpt rename to Zend/tests/type_declarations/relative_types/bug43332_1.phpt index 35d817c985ee..7639633c3e95 100644 --- a/Zend/tests/typehints/bug43332_1.phpt +++ b/Zend/tests/type_declarations/relative_types/bug43332_1.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #43332.1 (self and parent as type hint in namespace) +Bug #43332.1 (self and parent as type declaration in namespace) --FILE-- +--EXPECTF-- +Fatal error: Type declaration 'static' must be unqualified in %s on line %d diff --git a/Zend/tests/type_declarations/relative_types/static/namespace_relative_static.phpt b/Zend/tests/type_declarations/relative_types/static/namespace_relative_static.phpt new file mode 100644 index 000000000000..0c1cde76f147 --- /dev/null +++ b/Zend/tests/type_declarations/relative_types/static/namespace_relative_static.phpt @@ -0,0 +1,12 @@ +--TEST-- +namespace\static is not a valid type declaration +--DESCRIPTION-- +OSS-Fuzz: https://issues.oss-fuzz.com/issues/532353396 +--FILE-- + +--EXPECTF-- +Fatal error: Type declaration 'static' must be unqualified in %s on line %d diff --git a/Zend/tests/type_declarations/static_type_in_final_class.phpt b/Zend/tests/type_declarations/relative_types/static/static_type_in_final_class.phpt similarity index 100% rename from Zend/tests/type_declarations/static_type_in_final_class.phpt rename to Zend/tests/type_declarations/relative_types/static/static_type_in_final_class.phpt diff --git a/Zend/tests/type_declarations/static_type_outside_class.phpt b/Zend/tests/type_declarations/relative_types/static/static_type_outside_class.phpt similarity index 100% rename from Zend/tests/type_declarations/static_type_outside_class.phpt rename to Zend/tests/type_declarations/relative_types/static/static_type_outside_class.phpt diff --git a/Zend/tests/type_declarations/static_type_param.phpt b/Zend/tests/type_declarations/relative_types/static/static_type_param.phpt similarity index 100% rename from Zend/tests/type_declarations/static_type_param.phpt rename to Zend/tests/type_declarations/relative_types/static/static_type_param.phpt diff --git a/Zend/tests/type_declarations/static_type_property.phpt b/Zend/tests/type_declarations/relative_types/static/static_type_property.phpt similarity index 100% rename from Zend/tests/type_declarations/static_type_property.phpt rename to Zend/tests/type_declarations/relative_types/static/static_type_property.phpt diff --git a/Zend/tests/type_declarations/static_type_return.phpt b/Zend/tests/type_declarations/relative_types/static/static_type_return.phpt similarity index 100% rename from Zend/tests/type_declarations/static_type_return.phpt rename to Zend/tests/type_declarations/relative_types/static/static_type_return.phpt diff --git a/Zend/tests/type_declarations/static_type_trait.phpt b/Zend/tests/type_declarations/relative_types/static/static_type_trait.phpt similarity index 100% rename from Zend/tests/type_declarations/static_type_trait.phpt rename to Zend/tests/type_declarations/relative_types/static/static_type_trait.phpt diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d8d61ea979e4..941873663848 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -272,6 +272,7 @@ static const builtin_type_info builtin_types[] = { {ZEND_STRL("iterable"), IS_ITERABLE}, {ZEND_STRL("object"), IS_OBJECT}, {ZEND_STRL("mixed"), IS_MIXED}, + {ZEND_STRL("static"), IS_STATIC}, {NULL, 0, IS_UNDEF} }; @@ -7100,6 +7101,8 @@ static zend_type zend_compile_single_typename(zend_ast *ast) ZSTR_VAL(zend_string_tolower(type_name))); } + ZEND_ASSERT(type_code != IS_STATIC && "unqualified static type should have been handled by ZEND_AST_TYPE branch"); + /* Transform iterable into a type union alias */ if (type_code == IS_ITERABLE) { /* Set iterable bit for BC compat during Reflection and string representation of type */