xref: /PHP-7.1/Zend/tests/bug60536_003.phpt (revision 7af945e2)
1--TEST--
2Properties should be initialized correctly (relevant to #60536)
3--FILE--
4<?php
5error_reporting(E_ALL | E_STRICT);
6
7class BaseWithPropA {
8  private $hello = 0;
9}
10
11trait AHelloProperty {
12  private $hello = 0;
13}
14
15class BaseWithTPropB {
16    use AHelloProperty;
17}
18
19class SubclassA extends BaseWithPropA {
20    use AHelloProperty;
21}
22
23class SubclassB extends BaseWithTPropB {
24    use AHelloProperty;
25}
26
27$a = new SubclassA;
28var_dump($a);
29
30$b = new SubclassB;
31var_dump($b);
32
33?>
34--EXPECTF--
35object(SubclassA)#%d (2) {
36  ["hello":"SubclassA":private]=>
37  int(0)
38  ["hello":"BaseWithPropA":private]=>
39  int(0)
40}
41object(SubclassB)#%d (2) {
42  ["hello":"SubclassB":private]=>
43  int(0)
44  ["hello":"BaseWithTPropB":private]=>
45  int(0)
46}
47