xref: /PHP-5.5/Zend/tests/bug60536_005.phpt (revision 01dc4763)
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
33
34Strict Standards: Base and THello1 define the same property ($hello) in the composition of SameNameInSubClassProducesNotice. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in %s on line %d
35POST-CLASS-GUARD
36
37Strict Standards: Notice and THello1 define the same property ($hello) in the composition of Notice. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in %s on line %d
38POST-CLASS-GUARD2
39