iliaa           Tue Feb 25 11:21:00 2003 EDT

  Added files:                 
    /php4/ext/standard/tests/file       bug22414.phpt 

  Modified files:              
    /php4/ext/standard  exec.c 
  Log:
  Fixed bug #22414 and added a test case for it.
  
  
Index: php4/ext/standard/exec.c
diff -u php4/ext/standard/exec.c:1.95 php4/ext/standard/exec.c:1.96
--- php4/ext/standard/exec.c:1.95       Wed Feb 19 19:32:51 2003
+++ php4/ext/standard/exec.c    Tue Feb 25 11:21:00 2003
@@ -15,7 +15,7 @@
    | Author: Rasmus Lerdorf                                               |
    +----------------------------------------------------------------------+
  */
-/* $Id: exec.c,v 1.95 2003/02/20 00:32:51 iliaa Exp $ */
+/* $Id: exec.c,v 1.96 2003/02/25 16:21:00 iliaa Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -213,7 +213,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



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to