[wp-trac] [WordPress Trac] #10205: getmyuid() called instead of posix_getuid() in get_filesystem_method() (wp-admin/includes/file.php)

WordPress Trac noreply at wordpress.org
Thu Apr 25 23:19:21 UTC 2013


#10205: getmyuid() called instead of posix_getuid() in get_filesystem_method() (wp-
admin/includes/file.php)
------------------------------------+-----------------------------
 Reporter:  pgl                     |       Owner:  dd32
     Type:  enhancement             |      Status:  reopened
 Priority:  normal                  |   Milestone:  Future Release
Component:  Filesystem              |     Version:  2.8
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+-----------------------------

Comment (by rpostgate):

 I ran in to this problem also. All my fiddling with ownership of the
 relevant php files didn't seem to affect the outcome, so I decided to
 patch wp-admin/includes/file.php get_filesystem_method() to add the
 following check (the test write string isn't strictly necessary, but, what
 the heck, may as well be paranoid):


 {{{
                 if ( $temp_handle ) {
                         if ( getmyuid() == @fileowner($temp_file_name) )
                                 $method = 'direct';
 +                       @fputs($temp_handle, "test");
 +                       @fclose($temp_handle);
 +                       $temp_handle = @fopen($temp_file_name, "r");
 +                       if ($temp_handle) {
 +                               if (@fgets($temp_handle) == "test") {
 +                                       $method = 'direct';
 +                               }
 +                       }
                         @fclose($temp_handle);
                         @unlink($temp_file_name);
                 }
 }}}


 This way the original behavior is unchanged, but if an actual write to the
 test file is confirmed successful, direct file access is enabled.

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


More information about the wp-trac mailing list