summaryrefslogtreecommitdiff
path: root/ext/standard/exec.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-11-19 15:34:30 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-11-19 15:34:30 +0000
commit2b7b909e161e2e87bd24cbd894852c3929142c99 (patch)
tree30a9934b9aab484a7ebfcf1dc48b1f26b6fb368b /ext/standard/exec.c
parentb63803a06cb13360051085700fa8523066826441 (diff)
downloadphp-git-2b7b909e161e2e87bd24cbd894852c3929142c99.tar.gz
Fixed bug #26285 (escapeshellarg() uses wrong quotes on windows).
Diffstat (limited to 'ext/standard/exec.c')
-rw-r--r--ext/standard/exec.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index adc243f63c..842495b31c 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -322,20 +322,33 @@ char *php_escape_shell_arg(char *str) {
cmd = safe_emalloc(4, l, 3); /* worst case */
+#ifdef PHP_WIN32
+ cmd[y++] = '"';
+#else
cmd[y++] = '\'';
-
+#endif
+
for (x = 0; x < l; x++) {
switch (str[x]) {
+#ifdef PHP_WIN32
+ case '"':
+ cmd[y++] = '\\';
+#else
case '\'':
cmd[y++] = '\'';
cmd[y++] = '\\';
cmd[y++] = '\'';
+#endif
/* fall-through */
default:
cmd[y++] = str[x];
}
}
+#ifdef PHP_WIN32
+ cmd[y++] = '"';
+#else
cmd[y++] = '\'';
+#endif
cmd[y] = '\0';
return cmd;
}