cvs: php4(PHP_4_3) /ext/standard exec.c /ext/standard/tests/file bug22414.phpt
| From: | Ilia Alshanetsky | Date: | Tue, 25 Feb 2003 16:26:55 +0000 |
| Subject: | cvs: php4(PHP_4_3) /ext/standard exec.c /ext/standard/tests/file bug22414.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-19194@lists.php.net to get a copy of this message | ||
iliaa Tue Feb 25 11:26:55 2003 EDT
Added files: (Branch: PHP_4_3)
/php4/ext/standard/tests/file bug22414.phpt
Modified files:
/php4/ext/standard exec.c
Log:
MFH
Index: php4/ext/standard/exec.c
diff -u php4/ext/standard/exec.c:1.84.2.5 php4/ext/standard/exec.c:1.84.2.6
--- php4/ext/standard/exec.c:1.84.2.5 Wed Feb 19 19:34:24 2003
+++ php4/ext/standard/exec.c Tue Feb 25 11:26:54 2003
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.84.2.5 2003/02/20 00:34:24 iliaa Exp $ */
+/* $Id: exec.c,v 1.84.2.6 2003/02/25 16:26:54 iliaa Exp $ */
#include <stdio.h>
#include "php.h"
@@ -278,7 +278,7 @@
} 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);
}
Index: php4/ext/standard/tests/file/bug22414.phpt
+++ php4/ext/standard/tests/file/bug22414.phpt
--TEST--
Bug #22414: passthru() does not read data correctly
--SKIPIF--
<?php
if (empty(@shell_exec("which cat")) {
dir('skip cat binary needed for this test is not avaliable');
}
?>
--POST--
--GET--
--FILE--
<?php
$php = getenv('TEST_PHP_EXECUTABLE');
$pwd = realpath(dirname(__FILE__));
/* Regular Data Test */
passthru($php . ' -r " echo \"HELLO\"; "');
echo "\n";
/* Binary Data Test */
@unlink($pwd . '/passthru_test');
$cmd = $php . ' -r \' passthru("cat ' . $php . '"); \' >
' . $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