[wp-trac] [WordPress Trac] #54271: Multisite on Windows - media upload infinite loop.

WordPress Trac noreply at wordpress.org
Fri Oct 15 18:50:33 UTC 2021


#54271: Multisite on Windows - media upload infinite loop.
-------------------------------------------------+-------------------------
 Reporter:  ensemblebd                           |      Owner:  (none)
     Type:  defect (bug)                         |     Status:  new
 Priority:  normal                               |  Milestone:  Awaiting
                                                 |  Review
Component:  General                              |    Version:  5.8.1
 Severity:  major                                |   Keywords:  needs-patch
  Focuses:  administration, multisite, rest-api  |
-------------------------------------------------+-------------------------
 You have a flaw in your code in **/wp-includes/functions.php** line #
 8178.
 :: **clean_dirsize_cache**

 The while loop enters into an infinite loop UNLESS the path fed in starts
 with a slash.
 And on windows multisite, the path is prefixed with the full directory
 meaning it starts with "C:\" , meaning infinite loop.
 Which means file uploads never work due to a php timeout.
 I had to modify my core wordpress.

 So I modified: **/wp-admin/includes/file.php**  line # 981 as such to
 resolve:
 :: **_wp_handle_upload**
 {{{
         if ( is_multisite() ) {
                 $path = $new_file;
                 if (DIRECTORY_SEPARATOR == "\\") { // windows flaw in
 wordpress..
                         $parts = explode("wp-content", $path);
                         $path = $parts[1];
                 }
                 clean_dirsize_cache( $path );
         }
 }}}


 Good day and good coffee.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54271>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list