diff --git a/Zend/tests/type_declarations/typed_properties_protected_inheritance_mismatch.phpt b/Zend/tests/type_declarations/typed_properties_protected_inheritance_mismatch.phpt new file mode 100644 index 00000000000..1f03b5580f4 --- /dev/null +++ b/Zend/tests/type_declarations/typed_properties_protected_inheritance_mismatch.phpt @@ -0,0 +1,11 @@ +--TEST-- +Typed property invariance violation for protected properties +--FILE-- + +--EXPECTF-- +Fatal error: Type of B::$x must be int (as in class A) in %s on line %d diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 1a27bbdfb6c..220df561a2b 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -976,7 +976,7 @@ static void emit_incompatible_property_error( zend_error_noreturn(E_COMPILE_ERROR, "Type of %s::$%s must be %s (as in class %s)", ZSTR_VAL(child->ce->name), - ZSTR_VAL(child->name), + zend_get_unmangled_property_name(child->name), ZSTR_VAL(type_str), ZSTR_VAL(parent->ce->name)); }