xref: /PHP-7.1/Zend/tests/bug60536_005.phpt (revision 7af945e2)
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
5error_reporting(E_ALL | E_STRICT);
6
7class Base {
8  protected $hello;
9}
10
11trait THello1 {
12  protected $hello;
13}
14
15// Protected and public are handle more strict with a warning then what is
16// expected from normal inheritance since they can have easier coliding semantics
17echo "PRE-CLASS-GUARD\n";
18class SameNameInSubClassProducesNotice extends Base {
19    use THello1;
20}
21echo "POST-CLASS-GUARD\n";
22
23// now the same with a class that defines the property itself, too.
24
25class Notice extends Base {
26    use THello1;
27    protected $hello;
28}
29echo "POST-CLASS-GUARD2\n";
30?>
31--EXPECTF--
32PRE-CLASS-GUARD
33POST-CLASS-GUARD
34POST-CLASS-GUARD2
35