-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to specify the allowed "php" wrapper types
In addition of the current possibility to filter wrappers by their protocol name, also add the option to filter the "php" wrapper by the requested kind. Especially the 'filter' backend can be disabled that way.
- Loading branch information
Showing
9 changed files
with
247 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/tests/stream_wrapper/config/config_stream_wrapper_php.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sp.wrappers_whitelist.list("php"); | ||
sp.wrappers_whitelist.php_list("stdin,stderr,stdout"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--TEST-- | ||
Stream wrapper (php) | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded("snuffleupagus")) print "skip snuffleupagus extension missing"; | ||
?> | ||
--INI-- | ||
sp.configuration_file={PWD}/config/config_stream_wrapper_php.ini | ||
--FILE-- | ||
<?php | ||
echo file_get_contents('php://input'); | ||
file_put_contents('php://output', "Hello from stdout\n"); | ||
file_put_contents('php://stderr', "Hello from stderr #1\n"); | ||
file_put_contents('php://memory', "Bye from memory\n"); | ||
echo file_get_contents('php://memory'); | ||
file_put_contents('php://temp', "Bye from temp\n"); | ||
echo file_get_contents('php://temp'); | ||
|
||
file_put_contents('php://stderr', "Hello from stderr #2\n"); | ||
|
||
file_put_contents('php://filter/write=string.toupper/resource=output.tmp', "Hello from stdout filtered\n"); | ||
echo file_get_contents('php://filter/read=string.toupper/resource=output.tmp'); | ||
|
||
$foo = stream_wrapper_unregister("php"); | ||
fwrite(STDERR, $foo); | ||
file_put_contents('php://stderr', "Hello from stderr #3\n"); | ||
|
||
stream_wrapper_restore("php"); | ||
file_put_contents('php://stderr', "Hello from stderr #4\n"); | ||
file_put_contents('php://memory', "Bye from memory\n"); | ||
?> | ||
--EXPECTF-- | ||
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 | ||
|
||
Warning: file_get_contents(php://input): Failed to open stream: operation failed in %a/stream_wrapper_php.php on line 2 | ||
|
||
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 | ||
|
||
Warning: file_put_contents(php://output): Failed to open stream: operation failed in %a/stream_wrapper_php.php on line 3 | ||
Hello from stderr #1 | ||
|
||
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 | ||
|
||
Warning: file_put_contents(php://memory): Failed to open stream: operation failed in %a/stream_wrapper_php.php on line 5 | ||
|
||
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 | ||
|
||
Warning: file_get_contents(php://memory): Failed to open stream: operation failed in %a/stream_wrapper_php.php on line 6 | ||
|
||
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 | ||
|
||
Warning: file_put_contents(php://temp): Failed to open stream: operation failed in %a/stream_wrapper_php.php on line 7 | ||
|
||
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 | ||
|
||
Warning: file_get_contents(php://temp): Failed to open stream: operation failed in %a/stream_wrapper_php.php on line 8 | ||
Hello from stderr #2 | ||
|
||
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 | ||
|
||
Warning: file_put_contents(php://filter/write=string.toupper/resource=output.tmp): Failed to open stream: operation failed in %a/stream_wrapper_php.php on line 12 | ||
|
||
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 | ||
|
||
Warning: file_get_contents(php://filter/read=string.toupper/resource=output.tmp): Failed to open stream: operation failed in %a/stream_wrapper_php.php on line 13 | ||
1 | ||
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 | ||
|
||
Warning: file_put_contents(): file:// wrapper is disabled in the server configuration in %a/stream_wrapper_php.php on line 17 | ||
|
||
Warning: file_put_contents(php://stderr): Failed to open stream: no suitable wrapper could be found in %a/stream_wrapper_php.php on line 17 | ||
Hello from stderr #4 | ||
|
||
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 | ||
|
||
Warning: file_put_contents(php://memory): Failed to open stream: operation failed in %a/stream_wrapper_php.php on line 21 |