include_stat_is_quiet.phpt 856 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Stats executed during include path resolution should be silent
  3. --FILE--
  4. <?php
  5. class StreamWrapper {
  6. public function url_stat($path, $flags) {
  7. $path = str_replace('test://', 'file://', $path);
  8. if ($flags & STREAM_URL_STAT_QUIET) {
  9. return @stat($path);
  10. } else {
  11. return stat($path);
  12. }
  13. }
  14. }
  15. stream_wrapper_register('test', StreamWrapper::class);
  16. set_include_path('test://foo:test://bar');
  17. try {
  18. require_once 'doesnt_exist.php';
  19. } catch (Exception $e) {
  20. echo $e->getMessage(), "\n";
  21. }
  22. ?>
  23. --EXPECTF--
  24. Warning: require_once(doesnt_exist.php): Failed to open stream: No such file or directory in %s on line %d
  25. Fatal error: Uncaught Error: Failed opening required 'doesnt_exist.php' (include_path='test://foo:test://bar') in %s:%d
  26. Stack trace:
  27. #0 {main}
  28. thrown in %s on line %d