[wp-trac] [WordPress Trac] #10604: class-wp-filesystem-ssh2.php put_contents fails

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 13 23:10:03 UTC 2009


#10604: class-wp-filesystem-ssh2.php put_contents fails
-----------------------------+----------------------------------------------
 Reporter:  lostinlafayette  |       Owner:  dd32                   
     Type:  defect (bug)     |      Status:  new                    
 Priority:  normal           |   Milestone:  2.9                    
Component:  Filesystem       |     Version:  2.8                    
 Severity:  normal           |    Keywords:  has-patch needs-testing
-----------------------------+----------------------------------------------
Changes (by dd32):

  * keywords:  => has-patch needs-testing
  * version:  => 2.8
  * milestone:  Unassigned => 2.9


Comment:

 -finally-.. :)

 Learn something new every day, I didnt realise file_put_contents returns
 the number of bytes written..

 WP_Filesystem_SSH2::put_contents() needs to change from:
 {{{
 function put_contents($file, $contents, $type = '' ) {
                 $file = ltrim($file, '/');
                 return file_put_contents('ssh2.sftp://' . $this->sftp_link
 . '/' . $file, $contents);
         }
 }}}

 to
 {{{
 function put_contents($file, $contents, $type = '' ) {
                 $file = ltrim($file, '/');
                 return false !== file_put_contents('ssh2.sftp://' .
 $this->sftp_link . '/' . $file, $contents);
         }
 }}}

 So that it returns a boolean result.. False (ie failure) will still come
 through, but all integer or true values will come through as true.

 see patch.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10604#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list