com php-src: Fixed bug #69768 (escapeshell*() doesn't cater to !): ext/standard/exec.c ext/standard/tests/general_functions/esca
peshellarg_basic-win32.phpt ext/standard/tests/genera l_functions/escapeshellcmd-win32.phpt

From: Date: Tue, 23 Jun 2015 22:15:55 +0000
Subject: com php-src: Fixed bug #69768 (escapeshell*() doesn't cater to !): ext/standard/exec.c ext/standard/tests/general_functions/esca
peshellarg_basic-win32.phpt ext/standard/tests/genera l_functions/escapeshellcmd-win32.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87492@lists.php.net to get a copy of this message
Commit: a621781fdb733167f37027f02bf612696f892d07 Author: Christoph M. Becker <cmb@php.net> Wed, 24 Jun 2015 00:15:55 +0200 Parents: fdb580a5ade8dc1c2c728a3787a583d7fc05bfe8 Branches: PHP-5.4 PHP-5.5 PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a621781fdb733167f37027f02bf612696f892d07 Log: Fixed bug #69768 (escapeshell*() doesn't cater to !) When delayed variable substitution is enabled (can be set in the Registry, for instance), !ENV! works similar to %ENV%, and so ! should be escaped like %. Bugs: https://bugs.php.net/69768 Changed paths: M ext/standard/exec.c M ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt M ext/standard/tests/general_functions/escapeshellcmd-win32.phpt Diff: diff --git a/ext/standard/exec.c b/ext/standard/exec.c index d0b1e01..aa48735 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -281,9 +281,10 @@ PHPAPI char *php_escape_shell_cmd(char *str) break; #else /* % is Windows specific for enviromental variables, ^%PATH% will - output PATH whil ^%PATH^% not. escapeshellcmd will escape all %. + output PATH while ^%PATH^% will not. escapeshellcmd will escape all % and !. */ case '%': + case '!': case '"': case '\'': #endif @@ -366,6 +367,7 @@ PHPAPI char *php_escape_shell_arg(char *str) #ifdef PHP_WIN32 case '"': case '%': + case '!': cmd[y++] = ' '; break; #else diff --git a/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt b/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt index 8880056..d97c1a9 100644 --- a/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt +++ b/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt @@ -18,6 +18,7 @@ echo "Simple testcase for escapeshellarg() function\n"; var_dump(escapeshellarg("Mr O'Neil")); var_dump(escapeshellarg("Mr O\'Neil")); var_dump(escapeshellarg("%FILENAME")); +var_dump(escapeshellarg("!FILENAME")); var_dump(escapeshellarg("")); echo "Done\n"; @@ -27,5 +28,6 @@ Simple testcase for escapeshellarg() function string(11) ""Mr O'Neil"" string(12) ""Mr O\'Neil"" string(11) "" FILENAME"" +string(11) "" FILENAME"" string(2) """" Done \ No newline at end of file diff --git a/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt index 9fcb991..7d2a029 100644 --- a/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt +++ b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt @@ -17,7 +17,8 @@ $data = array( '%^', '#&;`|*?', '~<>\\', - '%NOENV%' + '%NOENV%', + '!NOENV!' ); $count = 1; @@ -46,4 +47,6 @@ string(14) "^#^&^;^`^|^*^?" string(8) "^~^<^>^\" -- Test 8 -- string(9) "^%NOENV^%" +-- Test 9 -- +string(9) "^!NOENV^!" Done

« previous php.cvs (#87492) next »