[wp-trac] [WordPress Trac] #53492: Fatal error serving media assets when `ms_files_rewriting` enabled

WordPress Trac noreply at wordpress.org
Wed Jun 23 20:56:07 UTC 2021


#53492: Fatal error serving media assets when `ms_files_rewriting` enabled
--------------------------+-----------------------------
 Reporter:  iandunn       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  high          |  Milestone:  Awaiting Review
Component:  Media         |    Version:  trunk
 Severity:  blocker       |   Keywords:
  Focuses:  multisite     |
--------------------------+-----------------------------
 r51211 introduced a fatal error for Multisites using `ms-files.php`.

 > Uncaught Error: Call to undefined function `wp_image_editor_supports()`
 in `wp-includes/functions.php` on line `3306`

 `ms-files.php` is loaded with `SHORTINIT`, so `media.php` never loads.
 Props @otto42, @barry, and @ryelle for help debugging.

 To reproduce:

 1. Setup Multisite
 1. `svn up -r 51210`
 1. `wp site option set ms_files_rewriting 1`
 1. Setup rewrite rules, restart web service. e.g.,
   {{{
 location / {
         rewrite ^/([_0-9a-zA-Z-]+/)?files/$ /index.php last;
         rewrite ^/([_0-9a-zA-Z-]+/)?files/(.+) /wp-includes/ms-
 files.php?file=$2 last;
 }
   }}}
 1. go to site that isn't main site
 1. upload new image
 1. view raw image, verify serving media from `/files/`. e.g., `https://foo
 .wp-develop.test/files/2021/06/pizza.jpg`
 1. `svn up -r 51211`
 1. change `error_reporting( 0 );` to `1` in `ms-files.php`
 1. refresh, the error should appear


 cc @azaozz, @adamsilverstein, @desrosj

 I'll start on a PR. Any ideas for the best approach?

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


More information about the wp-trac mailing list