1--TEST-- 2Test escapeshellcmd() functionality on Windows 3--SKIPIF-- 4<?php 5if( substr(PHP_OS, 0, 3) != 'WIN' ) { 6 die('skip...Valid for Windows only'); 7} 8?> 9--FILE-- 10<?php 11echo "*** Testing escapeshellcmd() basic operations ***\n"; 12$data = array( 13 '"abc', 14 "'abc", 15 '?<>', 16 '()[]{}$', 17 '%^', 18 '#&;`|*?', 19 '~<>\\', 20 '%NOENV%' 21); 22 23$count = 1; 24foreach ($data AS $value) { 25 echo "-- Test " . $count++ . " --\n"; 26 var_dump(escapeshellcmd($value)); 27} 28 29echo "Done\n"; 30?> 31--EXPECTF-- 32*** Testing escapeshellcmd() basic operations *** 33-- Test 1 -- 34string(5) "^"abc" 35-- Test 2 -- 36string(5) "^'abc" 37-- Test 3 -- 38string(6) "^?^<^>" 39-- Test 4 -- 40string(14) "^(^)^[^]^{^}^$" 41-- Test 5 -- 42string(4) "^%^^" 43-- Test 6 -- 44string(14) "^#^&^;^`^|^*^?" 45-- Test 7 -- 46string(8) "^~^<^>^\" 47-- Test 8 -- 48string(9) "^%NOENV^%" 49Done 50