}
}
-function system_with_timeout($commandline, $env = null)
+function system_with_timeout($commandline, $env = null, $stdin = null)
{
global $leak_check;
if (!$proc)
return false;
+ if (is_string($stdin)) {
+ fwrite($pipes[0], $stdin);
+ }
fclose($pipes[0]);
while (true) {
COMMAND $cmd
";
- $out = system_with_timeout($cmd, $env);
+ $out = system_with_timeout($cmd, $env, isset($section_text['STDIN']) ? $section_text['STDIN'] : null);
if (array_key_exists('CLEAN', $section_text) && (!$no_clean || $cfg['keep']['clean'])) {
if (trim($section_text['CLEAN'])) {
--- /dev/null
+--TEST--
+STDIN input
+--FILE--
+<?php
+var_dump(stream_get_contents(STDIN));
+var_dump(stream_get_contents(fopen('php://stdin', 'r')));
+var_dump(file_get_contents('php://stdin'));
+?>
+--STDIN--
+fooBar
+use this to input some thing to the php script
+--EXPECT--
+string(54) "fooBar
+use this to input some thing to the php script
+"
+string(0) ""
+string(0) ""