summaryrefslogtreecommitdiff
path: root/src/tests/stream_wrapper
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/stream_wrapper')
-rw-r--r--src/tests/stream_wrapper/config/config_stream_wrapper.ini1
-rw-r--r--src/tests/stream_wrapper/config/config_stream_wrapper_register.ini1
-rw-r--r--src/tests/stream_wrapper/stream_wrapper.phpt31
-rw-r--r--src/tests/stream_wrapper/stream_wrapper_register.phpt25
-rw-r--r--src/tests/stream_wrapper/stream_wrapper_restore.phpt17
5 files changed, 75 insertions, 0 deletions
diff --git a/src/tests/stream_wrapper/config/config_stream_wrapper.ini b/src/tests/stream_wrapper/config/config_stream_wrapper.ini
new file mode 100644
index 0000000..0cd7f77
--- /dev/null
+++ b/src/tests/stream_wrapper/config/config_stream_wrapper.ini
@@ -0,0 +1 @@
sp.wrappers_whitelist.list("https,FTP,does_not_exist");
diff --git a/src/tests/stream_wrapper/config/config_stream_wrapper_register.ini b/src/tests/stream_wrapper/config/config_stream_wrapper_register.ini
new file mode 100644
index 0000000..ee273a1
--- /dev/null
+++ b/src/tests/stream_wrapper/config/config_stream_wrapper_register.ini
@@ -0,0 +1 @@
sp.wrappers_whitelist.list("php,lelel");
diff --git a/src/tests/stream_wrapper/stream_wrapper.phpt b/src/tests/stream_wrapper/stream_wrapper.phpt
new file mode 100644
index 0000000..fdea50c
--- /dev/null
+++ b/src/tests/stream_wrapper/stream_wrapper.phpt
@@ -0,0 +1,31 @@
1--TEST--
2Stream wrapper
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/config_stream_wrapper.ini
7--FILE--
8<?php
9file_get_contents('http://qweqwezxc');
10file_get_contents('https://qweqwezxc');
11file_get_contents('ftp://qweqwezxc');
12file_get_contents('lelel://qweqwezxc');
13?>
14--EXPECTF--
15Warning: Unknown: Unable to find the wrapper "php" - did you forget to enable it when you configured PHP? in Unknown on line 0
16
17Warning: Unknown: Unable to find the wrapper "php" - did you forget to enable it when you configured PHP? in Unknown on line 0
18
19Warning: Unknown: Unable to find the wrapper "php" - did you forget to enable it when you configured PHP? in Unknown on line 0
20
21Warning: file_get_contents(): Unable to find the wrapper "http" - did you forget to enable it when you configured PHP? in %a/stream_wrapper.php on line %d
22
23Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: %s
24
25Warning: file_get_contents(https://qweqwezxc): failed to open stream: php_network_getaddresses: getaddrinfo failed: %s
26
27Warning: file_get_contents(ftp://qweqwezxc): failed to open stream: operation failed in %a/stream_wrapper.php on line %d
28
29Warning: file_get_contents(): Unable to find the wrapper "lelel" - did you forget to enable it when you configured PHP? in %a/stream_wrapper.php on line %d
30
31Warning: file_get_contents(lelel://qweqwezxc): failed to open stream: No such file or directory in %a/stream_wrapper.php on line %d
diff --git a/src/tests/stream_wrapper/stream_wrapper_register.phpt b/src/tests/stream_wrapper/stream_wrapper_register.phpt
new file mode 100644
index 0000000..39514e9
--- /dev/null
+++ b/src/tests/stream_wrapper/stream_wrapper_register.phpt
@@ -0,0 +1,25 @@
1--TEST--
2Stream wrapper
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/config_stream_wrapper_register.ini
7--FILE--
8<?php
9class qwe {
10 function stream_open($fname) {
11 return $fname;
12 }
13}
14
15stream_wrapper_register("lelel", "qwe");
16stream_wrapper_register("lolol", "qwe");
17fopen("lelel://asdasd", "r");
18fopen("lolol://asdasd", "r");
19?>
20--EXPECTF--
21Warning: fopen(): Unable to find the wrapper "lolol" - did you forget to enable it when you configured PHP? in %a/stream_wrapper_register.php on line %d
22
23Warning: fopen(): file:// wrapper is disabled in the server configuration in %a/stream_wrapper_register.php on line %d
24
25Warning: fopen(lolol://asdasd): failed to open stream: no suitable wrapper could be found in %a/stream_wrapper_register.php on line %d
diff --git a/src/tests/stream_wrapper/stream_wrapper_restore.phpt b/src/tests/stream_wrapper/stream_wrapper_restore.phpt
new file mode 100644
index 0000000..b4a29c8
--- /dev/null
+++ b/src/tests/stream_wrapper/stream_wrapper_restore.phpt
@@ -0,0 +1,17 @@
1--TEST--
2Stream wrapper
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/config_stream_wrapper_register.ini
7--FILE--
8<?php
9stream_wrapper_restore("file");
10fopen("file://asdasd", "r");
11?>
12--EXPECTF--
13Notice: stream_wrapper_restore(): file:// was never changed, nothing to restore in %a/stream_wrapper_restore.php on line %d
14
15Warning: fopen(): Unable to find the wrapper "file" - did you forget to enable it when you configured PHP? in %a/stream_wrapper_restore.php on line %d
16
17Warning: fopen(file://asdasd): failed to open stream: No such file or directory in %a/stream_wrapper_restore.php on line %d