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_php.ini2
-rw-r--r--src/tests/stream_wrapper/stream_wrapper_php.phpt76
2 files changed, 78 insertions, 0 deletions
diff --git a/src/tests/stream_wrapper/config/config_stream_wrapper_php.ini b/src/tests/stream_wrapper/config/config_stream_wrapper_php.ini
new file mode 100644
index 0000000..bec516c
--- /dev/null
+++ b/src/tests/stream_wrapper/config/config_stream_wrapper_php.ini
@@ -0,0 +1,2 @@
1sp.wrappers_whitelist.list("php");
2sp.wrappers_whitelist.php_list("stdin,stderr,stdout");
diff --git a/src/tests/stream_wrapper/stream_wrapper_php.phpt b/src/tests/stream_wrapper/stream_wrapper_php.phpt
new file mode 100644
index 0000000..c82d2f6
--- /dev/null
+++ b/src/tests/stream_wrapper/stream_wrapper_php.phpt
@@ -0,0 +1,76 @@
1--TEST--
2Stream wrapper (php)
3--SKIPIF--
4<?php
5if (!extension_loaded("snuffleupagus")) print "skip snuffleupagus extension missing";
6?>
7--INI--
8sp.configuration_file={PWD}/config/config_stream_wrapper_php.ini
9--FILE--
10<?php
11echo file_get_contents('php://input');
12file_put_contents('php://output', "Hello from stdout\n");
13file_put_contents('php://stderr', "Hello from stderr #1\n");
14file_put_contents('php://memory', "Bye from memory\n");
15echo file_get_contents('php://memory');
16file_put_contents('php://temp', "Bye from temp\n");
17echo file_get_contents('php://temp');
18
19file_put_contents('php://stderr', "Hello from stderr #2\n");
20
21file_put_contents('php://filter/write=string.toupper/resource=output.tmp', "Hello from stdout filtered\n");
22echo file_get_contents('php://filter/read=string.toupper/resource=output.tmp');
23
24$foo = stream_wrapper_unregister("php");
25fwrite(STDERR, $foo);
26file_put_contents('php://stderr', "Hello from stderr #3\n");
27
28stream_wrapper_restore("php");
29file_put_contents('php://stderr', "Hello from stderr #4\n");
30file_put_contents('php://memory', "Bye from memory\n");
31?>
32--EXPECTF--
33Warning: [snuffleupagus][0.0.0.0][wrappers_whitelist][log] Call to not allowed php stream type "input" dropped in %a/stream_wrapper_php.php on line 2
34
35Warning: file_get_contents(php://input): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 2
36
37Warning: [snuffleupagus][0.0.0.0][wrappers_whitelist][log] Call to not allowed php stream type "output" dropped in %a/stream_wrapper_php.php on line 3
38
39Warning: file_put_contents(php://output): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 3
40Hello from stderr #1
41
42Warning: [snuffleupagus][0.0.0.0][wrappers_whitelist][log] Call to not allowed php stream type "memory" dropped in %a/stream_wrapper_php.php on line 5
43
44Warning: file_put_contents(php://memory): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 5
45
46Warning: [snuffleupagus][0.0.0.0][wrappers_whitelist][log] Call to not allowed php stream type "memory" dropped in %a/stream_wrapper_php.php on line 6
47
48Warning: file_get_contents(php://memory): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 6
49
50Warning: [snuffleupagus][0.0.0.0][wrappers_whitelist][log] Call to not allowed php stream type "temp" dropped in %a/stream_wrapper_php.php on line 7
51
52Warning: file_put_contents(php://temp): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 7
53
54Warning: [snuffleupagus][0.0.0.0][wrappers_whitelist][log] Call to not allowed php stream type "temp" dropped in %a/stream_wrapper_php.php on line 8
55
56Warning: file_get_contents(php://temp): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 8
57Hello from stderr #2
58
59Warning: [snuffleupagus][0.0.0.0][wrappers_whitelist][log] Call to not allowed php stream type "filter" dropped in %a/stream_wrapper_php.php on line 12
60
61Warning: file_put_contents(php://filter/write=string.toupper/resource=output.tmp): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 12
62
63Warning: [snuffleupagus][0.0.0.0][wrappers_whitelist][log] Call to not allowed php stream type "filter" dropped in %a/stream_wrapper_php.php on line 13
64
65Warning: file_get_contents(php://filter/read=string.toupper/resource=output.tmp): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 13
661
67Warning: file_put_contents(): Unable to find the wrapper "php" - did you forget to enable it when you configured PHP? in %a/stream_wrapper_php.php on line 17
68
69Warning: file_put_contents(): file:// wrapper is disabled in the server configuration in %a/stream_wrapper_php.php on line 17
70
71Warning: file_put_contents(php://stderr): %s to open stream: no suitable wrapper could be found in %a/stream_wrapper_php.php on line 17
72Hello from stderr #4
73
74Warning: [snuffleupagus][0.0.0.0][wrappers_whitelist][log] Call to not allowed php stream type "memory" dropped in %a/stream_wrapper_php.php on line 21
75
76Warning: file_put_contents(php://memory): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 21