scottmac Tue Jul 22 16:21:16 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/standard/tests/general_functions escapeshellcmd-win32.phpt
Modified files: /php-src/ext/standard exec.c Log: MFH: Add test for escapeshellcmd and restore previous behaviour with stripping % on Windows. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.113.2.3.2.1.2.9&r2=1.113.2.3.2.1.2.10&diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.113.2.3.2.1.2.9 php-src/ext/standard/exec.c:1.113.2.3.2.1.2.10 --- php-src/ext/standard/exec.c:1.113.2.3.2.1.2.9 Fri May 30 16:56:57 2008 +++ php-src/ext/standard/exec.c Tue Jul 22 16:21:16 2008 @@ -16,7 +16,7 @@ | Ilia Alshanetsky <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: exec.c,v 1.113.2.3.2.1.2.9 2008/05/30 16:56:57 scottmac Exp $ */ +/* $Id: exec.c,v 1.113.2.3.2.1.2.10 2008/07/22 16:21:16 scottmac Exp $ */ #include <stdio.h> #include "php.h" @@ -299,6 +299,11 @@ } cmd[y++] = str[x]; break; +#else + /* This is Windows specific for enviromental variables */ + case '%': + cmd[y++] = ''; + break; #endif case '#': /* This is character-set independent */ case '&': @@ -322,8 +327,6 @@ case '\x0A': /* excluding these two */ case '\xFF': #ifdef PHP_WIN32 - /* This is Windows specific for enviromental variables */ - case '%': cmd[y++] = '^'; #else cmd[y++] = '\\'; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt +++ php-src/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt --TEST-- Test escapeshellcmd() functionality on Windows --SKIPIF-- <?php if( substr(PHP_OS, 0, 3) != 'WIN' ) { die('skip...Valid for Windows only'); } ?> --FILE-- <?php echo "*** Testing escapeshellcmd() basic operations ***\n"; $data = array( '"abc', "'abc", '?<>', '()[]{}$', '%^', '#&;`|*?', '~<>\\' ); $count = 1; foreach ($data AS $value) { echo "-- Test " . $count++ . " --\n"; var_dump(escapeshellcmd($value)); } echo "Done\n"; ?> --EXPECTF-- *** Testing escapeshellcmd() basic operations *** -- Test 1 -- string(5) "^"abc" -- Test 2 -- string(5) "^'abc" -- Test 3 -- string(6) "^?^<^>" -- Test 4 -- string(14) "^(^)^[^]^{^}^$" -- Test 5 -- string(2) "^^" -- Test 6 -- string(14) "^#^&^;^`^|^*^?" -- Test 7 -- string(8) "^~^<^>^\" Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php