summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-12-30 23:06:12 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-12-30 23:22:26 +0100
commit003be875e4dda029a358fb2d1da44a0b5ff86c6a (patch)
tree0f5d569b76bcbb28acc0b0107944be17bae890b0 /Zend
parent98df5c97f47dd3a50cb43763a1811f86f2ca912e (diff)
downloadphp-git-003be875e4dda029a358fb2d1da44a0b5ff86c6a.tar.gz
Make url_stats in resolve_path quiet
These stats are used to check whether the file exists -- they should not generate errors. Having the flag set is particularly important for custom stream wrappers.
Diffstat (limited to 'Zend')
-rw-r--r--Zend/tests/include_stat_is_quiet.phpt30
1 files changed, 30 insertions, 0 deletions
diff --git a/Zend/tests/include_stat_is_quiet.phpt b/Zend/tests/include_stat_is_quiet.phpt
new file mode 100644
index 0000000000..006fad50bd
--- /dev/null
+++ b/Zend/tests/include_stat_is_quiet.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Stats executed during include path resolution should be silent
+--FILE--
+<?php
+
+class StreamWrapper {
+ public function url_stat($path, $flags) {
+ $path = str_replace('test://', 'file://', $path);
+ if ($flags & STREAM_URL_STAT_QUIET) {
+ return @stat($path);
+ } else {
+ return stat($path);
+ }
+ }
+}
+
+stream_wrapper_register('test', StreamWrapper::class);
+set_include_path('test://foo:test://bar');
+
+try {
+ require_once 'doesnt_exist.php';
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECTF--
+Warning: require_once(doesnt_exist.php): failed to open stream: No such file or directory in %s on line %d
+
+Fatal error: require_once(): Failed opening required 'doesnt_exist.php' (include_path='test://foo:test://bar') in %s on line %d