#!/www/server/bin/php -qC 'gna')), "gna\n", "exec with argument"); is(it::exec("echo {0}", 'gna'), "gna\n", "exec with positional argument"); is(it::shell_command("echo {arg}", array('arg' => 'gna07,-:blah')), "echo gna07,-:blah", "don't quote arguments with only whitelistes characters"); is(it::shell_command("echo {arg}", array('arg' => '2>&1')), "echo '2>&1'", "quote arguments with dangerous characters"); is(it::shell_command("echo {arg}", array('arg' => '')), "echo ''", "quote empty arguments"); foreach (array("", "C", "de_CH", "de_CH.utf8") as $locale) { setlocale(LC_ALL, $locale); $arg = "preĆ¼post"; if (it::match('utf8', $locale)) $arg = utf8_encode($arg); is(it::exec("echo " . $arg), $arg . "\n", "exec with umlaut (locale '$locale')"); is(it::exec("echo {arg}", array('arg' => $arg)), $arg . "\n", "exec with argument and umlaut (locale '$locale')"); } is(it::_exec_quotevalue(""), "''", "empty arg needs quotes"); is(it::_exec_quotevalue("*"), "'*'", "special chars need quotes"); is(it::_exec_quotevalue("Aabcdef0123456789"), "Aabcdef0123456789", "simple case. tel:debug_getdata needs unquoted vals"); is(it::system('exit 0'), 0, 'return exit code 0'); is(it::system('exit 1'), 1, 'return exit code 1'); is(it::system('exit -1'), 255, 'return exit code unsigned'); @unlink('/tmp/it_system_test'); it::system('touch /tmp/it_system_test'); ok(file_exists('/tmp/it_system_test'), 'shell command gets executed'); @unlink('/tmp/it_system_test'); it::system('touch {path}', 'path' => '/tmp/it_system_test'); ok(file_exists('/tmp/it_system_test'), 'shell command with argument'); @unlink('/tmp/it_system_test'); it::system('touch {0}', '/tmp/it_system_test'); ok(file_exists('/tmp/it_system_test'), 'shell command with positional argument'); @unlink('/tmp/it_system_test');