bug55554a.phpt 597 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Bug #55137 (Legacy constructor not registered for class)
  3. --FILE--
  4. <?php
  5. // All constructors should be registered as such
  6. trait TConstructor {
  7. public function constructor() {
  8. echo "ctor executed\n";
  9. }
  10. }
  11. class NewConstructor {
  12. use TConstructor {
  13. constructor as __construct;
  14. }
  15. }
  16. class LegacyConstructor {
  17. use TConstructor {
  18. constructor as LegacyConstructor;
  19. }
  20. }
  21. echo "New constructor: ";
  22. $o = new NewConstructor;
  23. echo "Legacy constructor: ";
  24. $o = new LegacyConstructor;
  25. --EXPECT--
  26. New constructor: ctor executed
  27. Legacy constructor: ctor executed