[wp-trac] [WordPress Trac] #53789: all kinds of error messages using WordPress 5.8 Widgets block editor

WordPress Trac noreply at wordpress.org
Sun Sep 26 14:56:56 UTC 2021


#53789: all kinds of error messages using WordPress 5.8 Widgets block editor
-------------------------------+-----------------------------------------
 Reporter:  janecarole         |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Widgets            |     Version:  5.8
 Severity:  major              |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  javascript, administration
-------------------------------+-----------------------------------------

Comment (by timinaust):

 Just adding to the knowledge base ...

 I have just upgraded from 5.7.3 to 5.8.1 on my test server and have the
 same issue with the widgets editor reporting errors with the calendar
 block.  Mine was caused by MaxButtons 8.3 (an older version because of our
 ISP's old PHP version).  Test server is on PHP7.3.

 The javascript console was reporting 505 error on https://xxxxxxxxxx/wp-
 json/wp/v2/widget-types/calendar/encode?_locale=user

 The Apache error log has PHP recoverable fatal error in wp-includes
 /general-templates.php on line 2202. The problem was the global $m - used
 at this point, conflicting with use of $m in the plugin which used it to
 add a do_action to an new instance of main the plugin class.

 {{{
  PHP Recoverable fatal error:  Object of class
 MaxButtons\\maxButtonsPlugin could not be converted to string in
 /var/www/html/ecodev/wp-includes/general-template.php on line 2202,
 }}}

 maxButtons has fixed this in the later version (which I can't use because
 of PHP), but I suspect the use of something like $m as a global is always
 going to be a risk.

 Anyone having this issue - if you are lucky and can get to the apache
 error log, it may help quickly pin down the problem.

 **For the maintainers**: My problem is in the line creating an MD5 using
 the three globals $m, $monthnum and $year.  The function is trying to
 concatenate the erroneous instance of the object in $m, with $monthnum and
 $year.

 Looking at the rendering code in WPINC/blocks/calendar.php(16), it only
 declares globals for $monthnum and $year. I don't use calendar blocks and
 quick look didn't find anything that would create global $m in core files.
 Maybe the $m should be a '01' if creating an MD5 for the month, although
 $_GET\["m"\] is used in class-wp-list-table.php, so maybe that was the
 intent.

 I did see quite a few calls to wp_reset_vars for 's' in files like wp-
 admin/includes/class-wp-links-list-table.php, in what looks like ajax
 callback handling. I wonder if translating some of these ajax query
 parameters to globals could be the source of many of the plugin and theme
 related errors.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53789#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list