[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
Thu Apr 17 13:50:21 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             |  Resolution:
 Keywords:  needs-screenshots  |     Focuses:
-------------------------------+------------------------------

Comment (by devksec):

 Hello,

 Thanks for the prompt reply.

 Here’s more detailed evidence:

 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 on line 600
 Stack trace:
 #0 /wp-includes/block-supports/layout.php(600): array_intersect_key()
 #1 /wp-includes/class-wp-hook.php(326): wp_render_layout_support_flag()
 #2 /wp-includes/plugin.php(205): WP_Hook->apply_filters()
 #3 /wp-includes/class-wp-block.php(638): apply_filters()
 ...

 Debug output showing the invalid structure injected:

 [DEBUG] Invalid parentLayout: flex
 [DEBUG] Block with bad parentLayout: Array
 (
     [blockName] => core/social-links
     [attrs] => Array
         (
             [layout] => Array
                 (
                     [type] => flex
                     [orientation] => horizontal
                     [justifyContent] => space-between
                     [flexWrap] => nowrap
                 )
             ...
         )
     [parentLayout] => flex
 )

 Notice parentLayout => flex is passed as a string, not an array.
 When WordPress tries to array_intersect_key() this string, the fatal
 occurs.

 What triggered this:
 Using core/social-links inside a block theme layout

 Site uses full-site editing templates

 Running WordPress 6.5.2

 No Spectra or third-party block plugin involved in this specific crash

 Additional notes:

 Manually validating that parentLayout is an array inside layout.php
 prevents the fatal and allows the page to render normally.

 Issue occurs when layout-aware processing (wp_render_layout_support_flag)
 tries to apply to child blocks automatically.

 Would you also like me to provide a copy of the sample template where this
 happens?




 Happy to assist further!

 Best regards,

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


More information about the wp-trac mailing list