xref: /PHP-5.5/Zend/tests/traits/bug55554c.phpt (revision 7e4b9800)
1--TEST--
2Bug #55137 (Legacy constructor not registered for class)
3--FILE--
4<?php
5
6// Test that the behavior is consistent with the existing handling of new
7// and legacy constructors.
8// Here, the traits conflicts are overridden by local definitions,
9// and the two constructor definitions do not directly collide in that case.
10
11trait TC1 {
12    public function __construct() {
13        echo "TC1 executed\n";
14    }
15    public function ReportCollision() {
16        echo "TC1 executed\n";
17    }
18}
19
20trait TC2 {
21    public function __construct() {
22        echo "TC2 executed\n";
23    }
24    public function ReportCollision() {
25        echo "TC1 executed\n";
26    }
27}
28
29class ReportCollision {
30	use TC1, TC2;
31
32	public function __construct() {
33        echo "New constructor executed\n";
34    }
35    public function ReportCollision() {
36        echo "Legacy constructor executed\n";
37    }
38}
39
40
41echo "ReportCollision: ";
42$o = new ReportCollision;
43
44
45--EXPECTF--
46ReportCollision: New constructor executed
47