xref: /PHP-7.1/Zend/tests/bug60536_002.phpt (revision 7af945e2)
1--TEST--
2The same rules are applied for properties that are defined in the class hierarchy. Thus, if the properties are compatible, a notice is issued, if not a fatal error occures. (relevant with #60536)
3--FILE--
4<?php
5error_reporting(E_ALL | E_STRICT);
6
7class Base {
8  private $hello;
9}
10
11trait THello1 {
12  private $hello;
13}
14
15echo "PRE-CLASS-GUARD\n";
16class Notice extends Base {
17    use THello1;
18    private $hello;
19}
20echo "POST-CLASS-GUARD\n";
21
22// now we do the test for a fatal error
23
24class TraitsTest {
25	use THello1;
26    public $hello;
27}
28
29echo "POST-CLASS-GUARD2\n";
30
31$t = new TraitsTest;
32$t->hello = "foo";
33?>
34--EXPECTF--
35PRE-CLASS-GUARD
36POST-CLASS-GUARD
37
38Fatal error: TraitsTest and THello1 define the same property ($hello) in the composition of TraitsTest. However, the definition differs and is considered incompatible. Class was composed in %s on line %d
39