From: Ilia Alshanetsky Date: Tue, 25 Feb 2003 16:21:00 +0000 (+0000) Subject: Fixed bug #22414 and added a test case for it. X-Git-Tag: RELEASE_0_5~747 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f29964e2bac13b1f01337725fddff4282102019b;p=php Fixed bug #22414 and added a test case for it. --- diff --git a/ext/standard/exec.c b/ext/standard/exec.c index e38069ab72..a7d4078dd0 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -213,7 +213,7 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value TSRMLS_DC) } else { size_t b; - while ((b = fread(buf, buflen, 1, fp)) > 0) { + while((b = php_stream_read(stream, buf, EXEC_INPUT_BUF)) > 0) { if (output) { PHPWRITE(buf, b); } diff --git a/ext/standard/tests/file/bug22414.phpt b/ext/standard/tests/file/bug22414.phpt new file mode 100644 index 0000000000..c67ae2ed66 --- /dev/null +++ b/ext/standard/tests/file/bug22414.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #22414: passthru() does not read data correctly +--SKIPIF-- + +--POST-- +--GET-- +--FILE-- + ' . $pwd . '/passthru_test'; + exec($cmd); + + if (md5_file($php) == md5_file($pwd . '/passthru_test')) { + echo "Works\n"; + } else { + echo "Does not work\n"; + } + + @unlink($pwd . '/passthru_test'); +?> +--EXPECT-- +HELLO +Works