bug55554b.phpt 1004 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --TEST--
  2. Bug #55137 (Legacy constructor not registered for class)
  3. --FILE--
  4. <?php
  5. trait TConstructor {
  6. public function foo() {
  7. echo "foo executed\n";
  8. }
  9. public function bar() {
  10. echo "bar executed\n";
  11. }
  12. }
  13. class OverridingIsSilent1 {
  14. use TConstructor {
  15. foo as __construct;
  16. }
  17. public function __construct() {
  18. echo "OverridingIsSilent1 __construct\n";
  19. }
  20. }
  21. $o = new OverridingIsSilent1;
  22. class OverridingIsSilent2 {
  23. use TConstructor {
  24. foo as OverridingIsSilent2;
  25. }
  26. public function OverridingIsSilent2() {
  27. echo "OverridingIsSilent2 OverridingIsSilent2\n";
  28. }
  29. }
  30. $o = new OverridingIsSilent2;
  31. class ReportCollision {
  32. use TConstructor {
  33. bar as ReportCollision;
  34. foo as __construct;
  35. }
  36. }
  37. echo "ReportCollision: ";
  38. $o = new ReportCollision;
  39. --EXPECTF--
  40. OverridingIsSilent1 __construct
  41. OverridingIsSilent2 OverridingIsSilent2
  42. Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d