bug49908.phpt 641 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Bug #49908 (throwing exception in autoloader crashes when interface is not defined)
  3. --FILE--
  4. <?php
  5. spl_autoload_register(function ($className) {
  6. var_dump($className);
  7. if ($className == 'Foo') {
  8. class Foo implements Bar {};
  9. } else {
  10. throw new Exception($className);
  11. }
  12. });
  13. try {
  14. new Foo();
  15. } catch (Exception $e) { }
  16. // We never reach here.
  17. var_dump(new Foo());
  18. ?>
  19. --EXPECTF--
  20. string(3) "Foo"
  21. string(3) "Bar"
  22. string(3) "Foo"
  23. string(3) "Bar"
  24. Fatal error: Uncaught Exception: Bar in %s:%d
  25. Stack trace:
  26. #0 %s(%d): {closure}('Bar')
  27. #1 %s(%d): {closure}('Foo')
  28. #2 {main}
  29. thrown in %s on line %d