Make WordPress Core

Changes between Initial Version and Version 3 of Ticket #50019


Ignore:
Timestamp:
04/27/2020 07:50:11 PM (21 months ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #50019 – Description

    initial v3  
    11After updating my local sandbox to PHP 7.4, I started seeing errors on my Edit Page screen for my custom post type:
    22
    3 Notice: Trying to access array offset on value of type bool in /[..]/wp-admin/includes/template.php on line 1079, 1080, 1081
     3 Notice: Trying to access array offset on value of type bool in /[..]/wp-admin/includes/template.php on line 1079, 1080, 1081
    44
    55After some research, I narrowed down the issue to a call in one of my plugin, which removes one of the metaboxes on that screen:
    6 
     6{{{
    77remove_meta_box( 'profile_rolediv', 'people', 'normal' );
    8 
     8}}}
    99Everything had been working fine in earlier versions. Looking at the code in template.php, it looks like remove_meta_box just sets values to false, instead of removing the entry:
    10 
     10{{{
    1111function remove_meta_box( $id, $screen, $context ) {
    1212  .
     
    1616  .
    1717}
    18 
     18}}}
    1919which then causes this line in template.php to fail:
    20 
     20{{{
    2121$title = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['title'];
    22 
     22}}}
    2323Changing line 1078 in wp-admin/includes/template.php fixes the issue:
    24 
     24{{{
    2525} elseif ( 'sorted' == $priority && is_array( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) ) {
    26 
     26}}}
    2727Thank you,
    2828Jason