exception_during_variance_autoload.phpt 505 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Exception during delayed variance autoload
  3. --FILE--
  4. <?php
  5. spl_autoload_register(function($class) {
  6. echo "$class\n";
  7. if ($class == 'X') {
  8. new Y;
  9. }
  10. if ($class == 'Y') {
  11. new Q;
  12. }
  13. });
  14. class A {
  15. function method(): X {}
  16. }
  17. class B extends A {
  18. function method(): Y {}
  19. }
  20. ?>
  21. --EXPECTF--
  22. Y
  23. Q
  24. Fatal error: During inheritance of B, while autoloading Y: Uncaught Error: Class "Q" not found in %s:%d
  25. Stack trace:
  26. #0 %s(%d): {closure}('Y')
  27. #1 {main} in %s on line %d