summaryrefslogtreecommitdiff
path: root/ext/standard/exec.c
diff options
context:
space:
mode:
authorAndrei Zmievski <andrei@php.net>2000-02-22 18:00:32 +0000
committerAndrei Zmievski <andrei@php.net>2000-02-22 18:00:32 +0000
commit98674b73bdbaf9c26a20a722100539aefb97abe7 (patch)
tree60ab75c6d4b51fc28e23198de89fe84e690b96e4 /ext/standard/exec.c
parent9133a9b8b0f8740e47447579fd460025640a64da (diff)
downloadphp-git-98674b73bdbaf9c26a20a722100539aefb97abe7.tar.gz
(PHP exec) Return last line of output properly.
Diffstat (limited to 'ext/standard/exec.c')
-rw-r--r--ext/standard/exec.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index e9a81d09a8..f91750d31a 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -166,6 +166,14 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value)
while (l && isspace((int)buf[--l]));
if (l < t) buf[l + 1] = '\0';
+ /* Return last line from the shell command */
+ if (PG(magic_quotes_runtime)) {
+ int len;
+
+ tmp = php_addslashes(buf, 0, &len, 0);
+ RETVAL_STRINGL(tmp,len,0);
+ } else
+ RETVAL_STRINGL(buf,l,1);
} else {
int b, i;
@@ -174,14 +182,6 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value)
if (output) (void)PUTC(buf[i]);
}
}
-
- /* Return last line from the shell command */
- if (PG(magic_quotes_runtime) && type!=3) {
- int len;
-
- tmp = php_addslashes(buf, 0, &len, 0);
- RETVAL_STRINGL(tmp,len,0);
- }
ret = pclose(fp);
#if HAVE_SYS_WAIT_H