Edit report at http://bugs.php.net/bug.php?id=53500&edit=1

 ID:                 53500
 Updated by:         johan...@php.net
 Reported by:        sjaillet at gmail dot com
 Summary:            fread/feof doesn't detect the end of file using the
                     sftp wrapper
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Ubuntu 10.4 LTS
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

please report this as bug against the ssh2 extension on pecl.php.net
Thank You.


Previous Comments:
------------------------------------------------------------------------
[2010-12-08 17:13:31] sjaillet at gmail dot com

Description:
------------
fread/feof doesn't detect the end of file using the sftp wrapper.

an infinite loop occurcs when trying to read files.



OS: Ubuntu 10.4 TLS

PHP version : 5.3.2-1ubuntu4.5

openssh-server : 1:5.3p1-3ubuntu4

Test script:
---------------
#!/usr/bin/php

<?php

$connection = ssh2_connect('my.hostname.com', 22);

ssh2_auth_password($connection, 'mylogin', 'mypassword');

$sftp = ssh2_sftp($connection);

$stream = fopen('ssh2.sftp://'.$sftp.'/home/mylogin/test', 'w');

fwrite($stream, "bob");

fclose($stream);



print_r(file_get_contents('ssh2.sftp://'.$sftp.'/home/mylogin/test'));
//Works fine !



$source_handle = fopen('ssh2.sftp://'.$sftp.'/home/mylogin/test', "r");

if($source_handle){

        while (!feof($source_handle)) { //Infinite loop

                $buffer = fread($source_handle,1024);

                echo "*".$buffer."*";

        }

        fclose($source_handle);

}

?>

Expected result:
----------------
bob*bob*

Actual result:
--------------
bob*bob*********************************************... and so on.


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53500&edit=1

Reply via email to