[wp-trac] [WordPress Trac] #63296: array_intersect_key() fatal error in wp_render_layout_support_flag() due to invalid string parentLayout in core/social-links block

WordPress Trac noreply at wordpress.org
Wed Apr 16 17:00:14 UTC 2025


#63296: array_intersect_key() fatal error in wp_render_layout_support_flag() due to
invalid string parentLayout in core/social-links block
--------------------------+-----------------------------
 Reporter:  devksec       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.8
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When using the core/social-links block, WordPress core may crash with a
 fatal error:

 PHP Fatal error: Uncaught TypeError: array_intersect_key(): Argument #1
 ($array) must be of type array, string given in wp-includes/block-
 supports/layout.php

 This occurs because parentLayout is being passed as a string ("flex")
 instead of an array, likely during automatic layout injection in block
 rendering. Since wp_render_layout_support_flag() assumes both
 $block['attrs']['style']['layout'] and $block['parentLayout'] are arrays,
 it causes array_intersect_key() to throw a fatal.

 Steps to reproduce:
 1. Use a block template or block theme with core/social-links

 2. Enable full site editing or a block-based page layout

 3. Attempt to render the template or page

 4. Fatal error occurs on line 600+ in layout.php

 Proposed fix:
 Core layout support logic should include:

 php
 Copy
 Edit
 if ( is_array( $block['parentLayout'] ) ) {
     // only process layout
 }
 Or handle invalid structures more gracefully (e.g. log + fallback).

 Workaround:
 We patched layout.php by validating both layout and parentLayout as arrays
 before calling array_intersect_key().

 Impact:
 Breaks front-end rendering for many sites using block-based layouts.

 Likely triggered by changes in layout-aware blocks like core/social-links
 or reusable block wrappers.

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


More information about the wp-trac mailing list