1--TEST-- 2Bug #55137 (Legacy constructor not registered for class) 3--FILE-- 4<?php 5 6trait TConstructor { 7 public function foo() { 8 echo "foo executed\n"; 9 } 10 public function bar() { 11 echo "bar executed\n"; 12 } 13} 14 15class OverridingIsSilent1 { 16 use TConstructor { 17 foo as __construct; 18 } 19 20 public function __construct() { 21 echo "OverridingIsSilent1 __construct\n"; 22 } 23} 24 25$o = new OverridingIsSilent1; 26 27class OverridingIsSilent2 { 28 use TConstructor { 29 foo as OverridingIsSilent2; 30 } 31 32 public function OverridingIsSilent2() { 33 echo "OverridingIsSilent2 OverridingIsSilent2\n"; 34 } 35} 36 37$o = new OverridingIsSilent2; 38 39class ReportCollision { 40 use TConstructor { 41 bar as ReportCollision; 42 foo as __construct; 43 } 44} 45 46 47echo "ReportCollision: "; 48$o = new ReportCollision; 49 50 51--EXPECTF-- 52OverridingIsSilent1 __construct 53 54Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OverridingIsSilent2 has a deprecated constructor in %s on line %d 55OverridingIsSilent2 OverridingIsSilent2 56 57Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d 58 59