[wp-trac] [WordPress Trac] #45206: Logic error in do_meta_boxes() for Gutenberg support

WordPress Trac noreply at wordpress.org
Fri Oct 26 20:19:04 UTC 2018


#45206: Logic error in do_meta_boxes() for Gutenberg support
-----------------------------+------------------------------
 Reporter:  johnjamesjacoby  |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  General          |     Version:  5.0
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by johnjamesjacoby):

 [https://core.trac.wordpress.org/attachment/ticket/45206/45206.patch
 45206.patch] addresses the regression by wrapping the new Gutenberg-
 support code in a...

 {{{
 if ( is_array( $box[ 'args' ] ) ) { ... }
 }}}

 ...condition. I think this is correct, as it only addresses the new code
 causing new fatal errors. Another potential fix might be to the
 `add_meta_box()` function, to change the `$callback_args` default value
 from `null` to `array()`, but I chose not to touch an unrelated function
 at this time to avoid introducing other unexpected errors elsewhere.

 Outside of this specific plugin incompatibility, I believe this patch is a
 nice-to-have bit of hardening anyways. Since `$box['args']` is not
 guaranteed to be an array, it makes sense to continue to check it in new
 code the same as do with old, at least until such a time where meta-box
 code can be scrutinized more deeply.

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


More information about the wp-trac mailing list