[wp-trac] [WordPress Trac] #63957: PHP 8.5: Using `null` as array offsets

WordPress Trac noreply at wordpress.org
Thu Sep 11 12:10:39 UTC 2025


#63957: PHP 8.5: Using `null` as array offsets
-------------------------------+-------------------------------
 Reporter:  swissspidy         |      Owner:  (none)
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  6.9
Component:  General            |    Version:
 Severity:  normal             |   Keywords:  php85 needs-patch
  Focuses:  php-compatibility  |
-------------------------------+-------------------------------
 Parent ticket for all things PHP 8.5: #63061

 ----

 Using `null` as an array offset and when calling `array_key_exists()` is
 deprecated in PHP 8.5

 There are some places in core that need to be fixed.

 Two examples I've ran into today:


 `do_blocks` calls `parse_blocks` on post content, which can parse a simple
 string as a block with `blockName` of `null`. So when functions like
 `_wp_add_block_level_preset_styles` (hooked to `pre_render_block` use
 `$block['blockName']` and pass it to `WP_Block_Type_Registry`, this is
 where the warnings are triggered.

 Another, more obvious on in WP_Theme_JSON: https://github.com/WordPress
 /wordpress-develop/blob/c5909c4c51044758e3e9d75551c70b9c7fbace5f/src/wp-
 includes/class-wp-theme-json.php#L2888-L2894 - `$current_element` can be
 null

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


More information about the wp-trac mailing list