[gollem] avoid error message, when using ssh2-vfs-driver in gollem

Michael Gröne michael.groene at zew.uni-hannover.de
Wed Sep 16 15:00:29 UTC 2009


Playing around with gollem I ran into a write-error on my filesystem.
Not a problem so far - there will be an error-message (Die VFS-Datei  
"/home/local/ZEW/michael/test/filename" konnte nicht gespeichert  
werden.), but there will even php-errors be displayed which include  
the password in cleartext leading to "headers already sent"-errors:

Warning: copy() [function.copy]: Unable to open  
ssh2.sftp://zew\michael:(password)@fileserver.local:2000/home/local/ZEW/michael/test/filename on remote host in /var/www/horde_dev_124/lib/VFS/ssh2.php on line  
966

Warning:  
copy(ssh2.sftp://...@fileserver.zew.local:1984/home/local/ZEW/michael/test/filename) [function.copy]: failed to open stream: Bad file descriptor in /var/www/horde_dev_124/lib/VFS/ssh2.php on line  
966

Warning: Cannot modify header information - headers already sent by  
(output started at /var/www/horde_dev_124/lib/VFS/ssh2.php:966) in  
/var/www/horde_dev_124/gollem/templates/common-header.inc on line 3

Warning: Cannot modify header information - headers already sent by  
(output started at /var/www/horde_dev_124/lib/VFS/ssh2.php:966) in  
/var/www/horde_dev_124/gollem/templates/common-header.inc on line 4

My solution is to call the causing function with @ before  
(/lib/VFS/ssh2.php, line 966):
     /**
      * Sends local file to remote host.
      * This function exists because the php_scp_* functions doesn't  
seem to work on some hosts.
      *
      * @access private
      *
      * @param string $local   Full path to the local file.
      * @param string $remote  Full path to the remote location.
      *
      * @return boolean TRUE on success, FALSE on failure.
      */
     function _send($local, $remote)
     {
         return @copy($local, $this->_wrap($remote));
     }

     /**
      * Receives file from remote host.
      * This function exists because the php_scp_* functions doesn't  
seem to work on some hosts.
      *
      * @access private
      *
      * @param string $local  Full path to the local file.
      * @param string $remote Full path to the remote location.
      *
      * @return boolean TRUE on success, FALSE on failure.
      */
     function _recv($remote, $local)
     {
         return @copy($this->_wrap($remote), $local);
     }


Maybe this will be applied to the next version of gollem?


More information about the gollem mailing list