diff options
Diffstat (limited to 'src/tests/stream_wrapper')
| -rw-r--r-- | src/tests/stream_wrapper/config/config_stream_wrapper_php.ini | 2 | ||||
| -rw-r--r-- | src/tests/stream_wrapper/stream_wrapper_php.phpt | 76 |
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 @@ | |||
| 1 | sp.wrappers_whitelist.list("php"); | ||
| 2 | sp.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-- | ||
| 2 | Stream wrapper (php) | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php | ||
| 5 | if (!extension_loaded("snuffleupagus")) print "skip snuffleupagus extension missing"; | ||
| 6 | ?> | ||
| 7 | --INI-- | ||
| 8 | sp.configuration_file={PWD}/config/config_stream_wrapper_php.ini | ||
| 9 | --FILE-- | ||
| 10 | <?php | ||
| 11 | echo file_get_contents('php://input'); | ||
| 12 | file_put_contents('php://output', "Hello from stdout\n"); | ||
| 13 | file_put_contents('php://stderr', "Hello from stderr #1\n"); | ||
| 14 | file_put_contents('php://memory', "Bye from memory\n"); | ||
| 15 | echo file_get_contents('php://memory'); | ||
| 16 | file_put_contents('php://temp', "Bye from temp\n"); | ||
| 17 | echo file_get_contents('php://temp'); | ||
| 18 | |||
| 19 | file_put_contents('php://stderr', "Hello from stderr #2\n"); | ||
| 20 | |||
| 21 | file_put_contents('php://filter/write=string.toupper/resource=output.tmp', "Hello from stdout filtered\n"); | ||
| 22 | echo file_get_contents('php://filter/read=string.toupper/resource=output.tmp'); | ||
| 23 | |||
| 24 | $foo = stream_wrapper_unregister("php"); | ||
| 25 | fwrite(STDERR, $foo); | ||
| 26 | file_put_contents('php://stderr', "Hello from stderr #3\n"); | ||
| 27 | |||
| 28 | stream_wrapper_restore("php"); | ||
| 29 | file_put_contents('php://stderr', "Hello from stderr #4\n"); | ||
| 30 | file_put_contents('php://memory', "Bye from memory\n"); | ||
| 31 | ?> | ||
| 32 | --EXPECTF-- | ||
| 33 | Warning: [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 | |||
| 35 | Warning: file_get_contents(php://input): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 2 | ||
| 36 | |||
| 37 | Warning: [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 | |||
| 39 | Warning: file_put_contents(php://output): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 3 | ||
| 40 | Hello from stderr #1 | ||
| 41 | |||
| 42 | Warning: [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 | |||
| 44 | Warning: file_put_contents(php://memory): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 5 | ||
| 45 | |||
| 46 | Warning: [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 | |||
| 48 | Warning: file_get_contents(php://memory): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 6 | ||
| 49 | |||
| 50 | Warning: [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 | |||
| 52 | Warning: file_put_contents(php://temp): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 7 | ||
| 53 | |||
| 54 | Warning: [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 | |||
| 56 | Warning: file_get_contents(php://temp): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 8 | ||
| 57 | Hello from stderr #2 | ||
| 58 | |||
| 59 | Warning: [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 | |||
| 61 | Warning: 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 | |||
| 63 | Warning: [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 | |||
| 65 | Warning: 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 | ||
| 66 | 1 | ||
| 67 | Warning: 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 | |||
| 69 | Warning: file_put_contents(): file:// wrapper is disabled in the server configuration in %a/stream_wrapper_php.php on line 17 | ||
| 70 | |||
| 71 | Warning: file_put_contents(php://stderr): %s to open stream: no suitable wrapper could be found in %a/stream_wrapper_php.php on line 17 | ||
| 72 | Hello from stderr #4 | ||
| 73 | |||
| 74 | Warning: [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 | |||
| 76 | Warning: file_put_contents(php://memory): %s to open stream: operation failed in %a/stream_wrapper_php.php on line 21 | ||
