[wp-trac] [WordPress Trac] #55926: Fatal error after entered the empty value for 'Max upload file size' in wordpress network

WordPress Trac noreply at wordpress.org
Mon Jun 6 02:22:00 UTC 2022


#55926: Fatal error after entered the empty value for 'Max upload file size' in
wordpress network
---------------------------------------+-----------------------------
 Reporter:  mjkhajeh                   |      Owner:  (none)
     Type:  defect (bug)               |     Status:  new
 Priority:  normal                     |  Milestone:  Awaiting Review
Component:  Networks and Sites         |    Version:
 Severity:  critical                   |   Keywords:  has-patch
  Focuses:  administration, multisite  |
---------------------------------------+-----------------------------
 Hi, I entered the empty value for 'Max upload file size' in the wordpress
 network and WordPress is down.

 {{{
 <b>Fatal error</b>:  Uncaught TypeError: Unsupported operand types: string
 * int in /var/www/html/wordpress/wp-includes/ms-functions.php:2709
 Stack trace:
 #0 /var/www/html/wordpress/wp-includes/class-wp-hook.php(309):
 upload_size_limit_filter()
 #1 /var/www/html/wordpress/wp-includes/plugin.php(191):
 WP_Hook->apply_filters()
 #2 /var/www/html/wordpress/wp-includes/media.php(3751): apply_filters()
 #3 /var/www/html/wordpress/wp-includes/block-editor.php(156):
 wp_max_upload_size()
 #4 /var/www/html/wordpress/wp-includes/class-wp-theme-json-
 resolver.php(199): get_default_block_editor_settings()
 #5 /var/www/html/wordpress/wp-includes/class-wp-theme-json-
 resolver.php(384): WP_Theme_JSON_Resolver::get_theme_data()
 #6 /var/www/html/wordpress/wp-includes/script-loader.php(3076):
 WP_Theme_JSON_Resolver::get_merged_data()
 #7 /var/www/html/wordpress/wp-includes/script-loader.php(3272):
 {closure}()
 #8 /var/www/html/wordpress/wp-includes/class-wp-hook.php(307): {closure}()
 #9 /var/www/html/wordpress/wp-includes/class-wp-hook.php(331):
 WP_Hook->apply_filters()
 #10 /var/www/html/wordpress/wp-includes/plugin.php(476):
 WP_Hook->do_action()
 #11 /var/www/html/wordpress/wp-settings.php(620): do_action()
 #12 /var/www/html/wordpress/wp-config.php(103): require_once('...')
 #13 /var/www/html/wordpress/wp-load.php(50): require_once('...')
 #14 /var/www/html/wordpress/wp-admin/admin.php(34): require_once('...')
 #15 /var/www/html/wordpress/wp-admin/network/admin.php(13):
 require_once('...')
 #16 /var/www/html/wordpress/wp-admin/network/settings.php(11):
 require_once('...')
 #17 {main}
   thrown in <b>/var/www/html/wordpress/wp-includes/ms-functions.php</b> on
 line <b>2709</b><br />
 }}}

 For updating options, I use default values, compare new values with
 default, and then update them. Maybe this method also works for you:

 wp-admin/network/settings.php:111
 {{{#!php
 <?php
 $defaults = [
         'fileupload_maxk'       => 1500,
 ];
 }}}

 ----

 wp-admin/network/settings.php:123(After inserting $defaults. otherwise:
 121)
 {{{#!php
 <?php
 if ( ! isset( $_POST[ $option_name ] ) && !isset( $defaults[$option_name]
 ) ) {
         continue;
 } else if( isset( $defaults[$option_name] ) ) {
         $value = $defaults[$option_name];
 }
 }}}

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


More information about the wp-trac mailing list