summaryrefslogtreecommitdiff
path: root/ext/standard/exec.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2000-08-01 07:22:59 +0000
committerStanislav Malyshev <stas@php.net>2000-08-01 07:22:59 +0000
commite109aa30d67b4c4747941b7066e5d057a48a2ea3 (patch)
treefbe24ae01c02f7b1e402beaee98884b77bf8e58e /ext/standard/exec.c
parent7173a63d46ceda1b2d33e0d1fdb40faa32be91e6 (diff)
downloadphp-git-e109aa30d67b4c4747941b7066e5d057a48a2ea3.tar.gz
When output is empty, exec should return "", not "\0" (#5775)
@- Fixed exec() returning "\0" when output is empty
Diffstat (limited to 'ext/standard/exec.c')
-rw-r--r--ext/standard/exec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 7fc6acc033..63409520f0 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -172,8 +172,9 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value)
tmp = php_addslashes(buf, 0, &len, 0);
RETVAL_STRINGL(tmp,len,0);
- } else
- RETVAL_STRINGL(buf,l+1,1);
+ } else {
+ RETVAL_STRINGL(buf,l?l+1:0,1);
+ }
} else {
int b, i;