diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-09 08:49:42 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-09 08:49:42 +0100 |
commit | 33e39f088ab31916f5917500ca1beeb83ab0bfb5 (patch) | |
tree | 0a4069caaed01b9d06a5b78b3d51ec7ab946289e | |
parent | ded87a9ea0f12107031e6cac6c0299c1f87ff233 (diff) | |
parent | 5fcc12f505374bc7116f0e0f10c67a68f11907d6 (diff) | |
download | php-git-33e39f088ab31916f5917500ca1beeb83ab0bfb5.tar.gz |
Merge branch 'PHP-7.4'
* PHP-7.4:
Use unmangled named in property type inheritance error
-rw-r--r-- | Zend/tests/type_declarations/typed_properties_protected_inheritance_mismatch.phpt | 11 | ||||
-rw-r--r-- | Zend/zend_inheritance.c | 2 |
2 files changed, 12 insertions, 1 deletions
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-- +<?php + +class A { protected int $x; } +class B extends A { protected $x; } + +?> +--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 1a27bbdfb6..220df561a2 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)); } |