All of my sites are working except displaying images, attachments, etc. The sites are part of a multisite. The respective path parameters are:
- upload_path:
wp-content/blogs.dir/N/files- where N is the number of the site - upload_url_path:
https://www.domain.tld/files - fileupload_url:
https://www.domain.tld/files
This config worked until WP 6.7.x, but with WP 6.8 the error occurred on all sites.
The work-around described here with a static redirect for each site in .htaccess is only working for site=1.
UPDATE-1:
After fixing all minor PHP errors, no error message appeared except the WP critical error itself. Thus, I try to follow the code up to the point, where the error occurs. I started from .htaccess file at this line:
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$1 [L]
Here, wp-includes/ms-files.php is called. There, test outputs like echo( 'x' ); brought me to the function is_super_admin(). Calling this function generates the WP critical error. Digging deeper in file wp-includes/capabilities.php where the function is defined does not result in any further results - the critical error is directly thrown by calling is_super_admin(). I have no idea why and how to proceed in finding the source of the WP critical error.
UPDATE-2:
Receiving the error logs, I can confirm that is_super_admin() throws the error:
PHP Fatal error: Uncaught Error: Call to undefined function is_super_admin() in /home/USER/WWW/multisite/wordpress/wp-includes/ms-files.php:23
UPDATE-3:
It is announced, that WP 6.8.1 will fix the problem: https://core.trac.wordpress.org/ticket/63285
UPDATE-4:
After WP 6.8.1 the critical error disappeared, but uploaded files are still not displayed (a 404 appears instead). Tracking ms-files.php up to line 28
$file = rtrim( BLOGUPLOADDIR, '/' ) . '/' . str_replace( '..', '', $_GET['file'] );
I found, that the path to the uploaded files BLOGUPLOADDIR is correct, but the filename is missing, because PHP superglobal $_GET['file'] is empty.
wp-content/debug.logwhen enabled viaWP_DEBUG_LOGinwp-config.php, and there should be provisions for an error log file by your host that you can download/read. Eitherway without the PHP error message and the associated code it's very difficult if not impossible for you to get help online with this