exception_during_include_stat.phpt 786 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. Make sure exceptions during include/require stating are properly propagated
  3. --FILE--
  4. <?php
  5. class StreamWrapper {
  6. public function url_stat($path, $flags) {
  7. throw new Exception('stat failed');
  8. }
  9. }
  10. stream_wrapper_register('test', StreamWrapper::class);
  11. set_include_path('test://foo:test://bar');
  12. try {
  13. require_once 'doesnt_exist.php';
  14. } catch (Exception $e) {
  15. echo $e->getMessage(), "\n";
  16. }
  17. try {
  18. require 'doesnt_exist.php';
  19. } catch (Exception $e) {
  20. echo $e->getMessage(), "\n";
  21. }
  22. try {
  23. include_once 'doesnt_exist.php';
  24. } catch (Exception $e) {
  25. echo $e->getMessage(), "\n";
  26. }
  27. try {
  28. include 'doesnt_exist.php';
  29. } catch (Exception $e) {
  30. echo $e->getMessage(), "\n";
  31. }
  32. ?>
  33. --EXPECT--
  34. stat failed
  35. stat failed
  36. stat failed
  37. stat failed