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 '!NOENV!' 22); 23 24$count = 1; 25foreach ($data AS $value) { 26 echo "-- Test " . $count++ . " --\n"; 27 var_dump(escapeshellcmd($value)); 28} 29 30echo "Done\n"; 31?> 32--EXPECTF-- 33*** Testing escapeshellcmd() basic operations *** 34-- Test 1 -- 35string(5) "^"abc" 36-- Test 2 -- 37string(5) "^'abc" 38-- Test 3 -- 39string(6) "^?^<^>" 40-- Test 4 -- 41string(14) "^(^)^[^]^{^}^$" 42-- Test 5 -- 43string(4) "^%^^" 44-- Test 6 -- 45string(14) "^#^&^;^`^|^*^?" 46-- Test 7 -- 47string(8) "^~^<^>^\" 48-- Test 8 -- 49string(9) "^%NOENV^%" 50-- Test 9 -- 51string(9) "^!NOENV^!" 52Done 53