[php-src] master: Merge branch 'PHP-8.5'

From: Date: Sat, 19 Sep 2026 15:02:02 +0000
Subject: [php-src] master: Merge branch 'PHP-8.5'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141278@lists.php.net to get a copy of this message
Author: Gina Peter Banyard (Girgias) Date: 2026-09-19T16:01:36+01:00 Commit: https://github.com/php/php-src/commit/6d1040627b487258962752ded4b903d3d1143803 Raw diff: https://github.com/php/php-src/commit/6d1040627b487258962752ded4b903d3d1143803.diff Merge branch 'PHP-8.5' Changed paths: A Zend/tests/type_declarations/iterable/bug76198.phpt A Zend/tests/type_declarations/relative_types/bug43332_1.phpt A Zend/tests/type_declarations/relative_types/bug43332_2.phpt A Zend/tests/type_declarations/relative_types/bug60573.phpt A Zend/tests/type_declarations/relative_types/bug60573_2.phpt A Zend/tests/type_declarations/relative_types/parent_is_not_proto.phpt A Zend/tests/type_declarations/relative_types/self_on_closure_in_method.phpt A Zend/tests/type_declarations/relative_types/static/fully_qualified_static.phpt A Zend/tests/type_declarations/relative_types/static/namespace_relative_static.phpt A Zend/tests/type_declarations/relative_types/static/static_type_in_final_class.phpt A Zend/tests/type_declarations/relative_types/static/static_type_outside_class.phpt A Zend/tests/type_declarations/relative_types/static/static_type_param.phpt A Zend/tests/type_declarations/relative_types/static/static_type_property.phpt A Zend/tests/type_declarations/relative_types/static/static_type_return.phpt A Zend/tests/type_declarations/relative_types/static/static_type_trait.phpt D Zend/tests/type_declarations/parent_is_not_proto.phpt D Zend/tests/type_declarations/self_on_closure_in_method.phpt D Zend/tests/type_declarations/static_type_in_final_class.phpt D Zend/tests/type_declarations/static_type_outside_class.phpt D Zend/tests/type_declarations/static_type_param.phpt D Zend/tests/type_declarations/static_type_property.phpt D Zend/tests/type_declarations/static_type_return.phpt D Zend/tests/type_declarations/static_type_trait.phpt D Zend/tests/typehints/bug43332_1.phpt D Zend/tests/typehints/bug43332_2.phpt D Zend/tests/typehints/bug60573.phpt D Zend/tests/typehints/bug60573_2.phpt D Zend/tests/typehints/bug76198.phpt M NEWS M Zend/zend_compile.c Diff: diff --git a/NEWS b/NEWS index a8b6f11e981a..25513e040f0c 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ PHP NEWS compacting arrays with holes. (Weilin Du) . Fix handling of references to typed properties during unserialization of various internal classes. (ndossche, timwolla) + . Fixed OSS-Fuzz 532353396 (assertion failure with static type). (Girgias) - Date: . Fix unserialization of Time\Duration. (timwolla) 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-- <?php namespace foobar; diff --git a/Zend/tests/typehints/bug43332_2.phpt b/Zend/tests/type_declarations/relative_types/bug43332_2.phpt similarity index 80% rename from Zend/tests/typehints/bug43332_2.phpt rename to Zend/tests/type_declarations/relative_types/bug43332_2.phpt index 604479e60660..2cc3c58197b9 100644 --- a/Zend/tests/typehints/bug43332_2.phpt +++ b/Zend/tests/type_declarations/relative_types/bug43332_2.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #43332.2 (self and parent as type hint in namespace) +Bug #43332.2 (self and parent as type declaration in namespace) --FILE-- <?php namespace foobar; diff --git a/Zend/tests/typehints/bug60573.phpt b/Zend/tests/type_declarations/relative_types/bug60573.phpt similarity index 90% rename from Zend/tests/typehints/bug60573.phpt rename to Zend/tests/type_declarations/relative_types/bug60573.phpt index 50650f54197f..4e6079ed1aee 100644 --- a/Zend/tests/typehints/bug60573.phpt +++ b/Zend/tests/type_declarations/relative_types/bug60573.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #60573 (type hinting with "self" keyword causes weird errors) +Bug #60573 (type declaration with "self" keyword causes weird errors) --FILE-- <?php class Foo1 { diff --git a/Zend/tests/typehints/bug60573_2.phpt b/Zend/tests/type_declarations/relative_types/bug60573_2.phpt similarity index 90% rename from Zend/tests/typehints/bug60573_2.phpt rename to Zend/tests/type_declarations/relative_types/bug60573_2.phpt index 221745316a83..cc0171fd7e07 100644 --- a/Zend/tests/typehints/bug60573_2.phpt +++ b/Zend/tests/type_declarations/relative_types/bug60573_2.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #60573 (type hinting with "self" keyword causes weird errors) -- variation 2 +Bug #60573 (type declaration with "self" keyword causes weird errors) -- variation 2 --FILE-- <?php class Foo1 { diff --git a/Zend/tests/type_declarations/parent_is_not_proto.phpt b/Zend/tests/type_declarations/relative_types/parent_is_not_proto.phpt similarity index 100% rename from Zend/tests/type_declarations/parent_is_not_proto.phpt rename to Zend/tests/type_declarations/relative_types/parent_is_not_proto.phpt diff --git a/Zend/tests/type_declarations/self_on_closure_in_method.phpt b/Zend/tests/type_declarations/relative_types/self_on_closure_in_method.phpt similarity index 100% rename from Zend/tests/type_declarations/self_on_closure_in_method.phpt rename to Zend/tests/type_declarations/relative_types/self_on_closure_in_method.phpt diff --git a/Zend/tests/type_declarations/relative_types/static/fully_qualified_static.phpt b/Zend/tests/type_declarations/relative_types/static/fully_qualified_static.phpt new file mode 100644 index 000000000000..4967e3f3d116 --- /dev/null +++ b/Zend/tests/type_declarations/relative_types/static/fully_qualified_static.phpt @@ -0,0 +1,12 @@ +--TEST-- +Fully qualified (leading backslash) static type names must fail +--DESCRIPTION-- +OSS-Fuzz: https://issues.oss-fuzz.com/issues/532353396 +--FILE-- +<?php + +function test($i): \static {} + +?> +--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-- +<?php + +function test($i): namespace\static {} + +?> +--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 7151d0764faf..f6bff9830bf6 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -281,6 +281,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} }; @@ -7641,6 +7642,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 */

« previous php.cvs (#141278) next »