From a3f8bb33cdf810f599be5a7925e43e24bc60bbd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Mon, 23 May 2022 09:44:40 +0200 Subject: [PATCH] Remove special case for the error message of static properties in readonly classes --- Zend/tests/readonly_classes/readonly_class_property3.phpt | 2 +- Zend/zend_compile.c | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Zend/tests/readonly_classes/readonly_class_property3.phpt b/Zend/tests/readonly_classes/readonly_class_property3.phpt index e121f4e49ee..34df1dde708 100644 --- a/Zend/tests/readonly_classes/readonly_class_property3.phpt +++ b/Zend/tests/readonly_classes/readonly_class_property3.phpt @@ -10,4 +10,4 @@ readonly class Foo ?> --EXPECTF-- -Fatal error: Readonly class Foo cannot declare static properties in %s on line %d +Fatal error: Static property Foo::$bar cannot be readonly in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 227b793d1c8..6c06a0a01b9 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -7256,12 +7256,6 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f zend_error_noreturn(E_COMPILE_ERROR, "Properties cannot be declared abstract"); } - if ((ce->ce_flags & ZEND_ACC_READONLY_CLASS) && (flags & ZEND_ACC_STATIC)) { - zend_error_noreturn(E_COMPILE_ERROR, "Readonly class %s cannot declare static properties", - ZSTR_VAL(ce->name) - ); - } - for (i = 0; i < children; ++i) { zend_property_info *info; zend_ast *prop_ast = list->child[i];