scottmac                Tue Jul 22 16:18:37 2008 UTC

  Added files:                 
    /php-src/ext/standard/tests/general_functions       
                                                        
escapeshellcmd-win32.phpt 

  Modified files:              
    /php-src/ext/standard       exec.c 
  Log:
  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.133&r2=1.134&diff_format=u
Index: php-src/ext/standard/exec.c
diff -u php-src/ext/standard/exec.c:1.133 php-src/ext/standard/exec.c:1.134
--- php-src/ext/standard/exec.c:1.133   Fri May 30 16:52:06 2008
+++ php-src/ext/standard/exec.c Tue Jul 22 16:18:37 2008
@@ -16,7 +16,7 @@
    |         Ilia Alshanetsky <[EMAIL PROTECTED]>                             |
    +----------------------------------------------------------------------+
  */
-/* $Id: exec.c,v 1.133 2008/05/30 16:52:06 scottmac Exp $ */
+/* $Id: exec.c,v 1.134 2008/07/22 16:18:37 scottmac Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -284,6 +284,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 '&':
@@ -307,8 +312,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

Reply via email to