diff --git a/Zend/tests/asymmetric_visibility/static_props.phpt b/Zend/tests/asymmetric_visibility/static_props.phpt new file mode 100644 index 0000000000000..65fd3aa1923d2 --- /dev/null +++ b/Zend/tests/asymmetric_visibility/static_props.phpt @@ -0,0 +1,12 @@ +--TEST-- +Asymmetric visibility on static props +--FILE-- + +--EXPECTF-- +Fatal error: Static property may not have asymmetric visibility in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 99938df0c8f09..ae50c29dffad6 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -8598,6 +8598,10 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f zend_error_noreturn(E_COMPILE_ERROR, "Property cannot be both final and private"); } + if ((flags & ZEND_ACC_STATIC) && (flags & ZEND_ACC_PPP_SET_MASK)) { + zend_error_noreturn(E_COMPILE_ERROR, "Static property may not have asymmetric visibility"); + } + if (ce->ce_flags & ZEND_ACC_INTERFACE) { if (flags & ZEND_ACC_FINAL) { zend_error_noreturn(E_COMPILE_ERROR, "Property in interface cannot be final");