xref: /PHP-7.4/Zend/tests/bug60536_005.phpt (revision 782352c5)
1--TEST--
2Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consitent with normal inheritance handling. (relevant to #60536)
3--FILE--
4<?php
5
6class Base {
7  protected $hello;
8}
9
10trait THello1 {
11  protected $hello;
12}
13
14// Protected and public are handle more strict with a warning then what is
15// expected from normal inheritance since they can have easier coliding semantics
16echo "PRE-CLASS-GUARD\n";
17class SameNameInSubClassProducesNotice extends Base {
18    use THello1;
19}
20echo "POST-CLASS-GUARD\n";
21
22// now the same with a class that defines the property itself, too.
23
24class Notice extends Base {
25    use THello1;
26    protected $hello;
27}
28echo "POST-CLASS-GUARD2\n";
29?>
30--EXPECT--
31PRE-CLASS-GUARD
32POST-CLASS-GUARD
33POST-CLASS-GUARD2
34