From: Nikita Popov Date: Mon, 9 Dec 2019 07:48:33 +0000 (+0100) Subject: Use unmangled named in property type inheritance error X-Git-Tag: php-7.4.7RC1~459 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5fcc12f505374bc7116f0e0f10c67a68f11907d6;p=php Use unmangled named in property type inheritance error --- 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 0000000000..1f03b5580f --- /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 56d9e6268f..0dbb5b77a6 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -936,7 +936,7 @@ static void emit_incompatible_property_error( zend_error_noreturn(E_COMPILE_ERROR, "Type of %s::$%s must be %s%s (as in class %s)", ZSTR_VAL(child->ce->name), - ZSTR_VAL(child->name), + zend_get_unmangled_property_name(child->name), ZEND_TYPE_ALLOW_NULL(parent->type) ? "?" : "", ZEND_TYPE_IS_CLASS(parent->type) ? ZSTR_VAL(ZEND_TYPE_IS_CE(parent->type) ? ZEND_TYPE_CE(parent->type)->name : resolve_class_name(parent->ce, ZEND_TYPE_NAME(parent->type)))