bug55554c.phpt 982 B

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