Skip to content

Commit 33e39f0

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Use unmangled named in property type inheritance error
2 parents ded87a9 + 5fcc12f commit 33e39f0

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Typed property invariance violation for protected properties
3+
--FILE--
4+
<?php
5+
6+
class A { protected int $x; }
7+
class B extends A { protected $x; }
8+
9+
?>
10+
--EXPECTF--
11+
Fatal error: Type of B::$x must be int (as in class A) in %s on line %d

Zend/zend_inheritance.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ static void emit_incompatible_property_error(
976976
zend_error_noreturn(E_COMPILE_ERROR,
977977
"Type of %s::$%s must be %s (as in class %s)",
978978
ZSTR_VAL(child->ce->name),
979-
ZSTR_VAL(child->name),
979+
zend_get_unmangled_property_name(child->name),
980980
ZSTR_VAL(type_str),
981981
ZSTR_VAL(parent->ce->name));
982982
}

0 commit comments

Comments
 (0)