[wp-trac] [WordPress Trac] #59968: Fatal error when access the FE with 2022 theme with WP 6.4.1

WordPress Trac noreply at wordpress.org
Tue Nov 28 15:31:45 UTC 2023


#59968: Fatal error when access the FE with 2022 theme with WP 6.4.1
--------------------------+------------------------------
 Reporter:  mai21         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Themes        |     Version:
 Severity:  critical      |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Old description:

> **Steps:**
> 1- WP version 6.4.1
> 2- The active theme is twenty twenty-two version 1.6
> 3- Visit the home page => fatal error is there
>

> {{{
> [27-Nov-2023 09:57:34 UTC] PHP Fatal error:  Uncaught TypeError:
> array_key_exists(): Argument #2 ($array) must be of type array, null
> given in /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/block-
> supports/align.php:48
> Stack trace:
> #0 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-block-
> supports.php(119): wp_apply_alignment_support()
> #1 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-block-
> supports.php(176): WP_Block_Supports->apply_block_supports()
> #2 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/blocks/site-
> logo.php(56): get_block_wrapper_attributes()
> #3 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-
> block.php(258): render_block_core_site_logo()
> #4 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-
> block.php(244): WP_Block->render()
> #5 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-
> block.php(244): WP_Block->render()
> #6 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-
> block.php(244): WP_Block->render()
> #7 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/blocks.php(1484):
> WP_Block->render()
> #8 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/blocks.php(1522):
> render_block()
> #9 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/blocks/template-
> part.php(144): do_blocks()
> #10 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-
> block.php(258): render_block_core_template_part()
> #11 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/blocks.php(1484):
> WP_Block->render()
> #12 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/blocks.php(1522):
> render_block()
> #13 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/block-
> template.php(260): do_blocks()
> #14 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/template-
> canvas.php(12): get_the_block_template_html()
> #15 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/template-
> loader.php(106): include('...')
> #16 /var/www/new.rocketlabsqa.ovh/htdocs/wp-blog-header.php(19):
> require_once('...')
> #17 /var/www/new.rocketlabsqa.ovh/htdocs/index.php(17): require('...')
> #18 {main}
>   thrown in /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/block-
> supports/align.php on line 48
> }}}
>
> **Expected**
> No fatal error and the home page is displayed correctly
>
> **Note:**
> Tested on Ubuntu 23.10, Chrome Version 119.0.6045.123 (Official Build)

New description:

 **Steps:**
 1- WP version 6.4.1
 2- The active theme is twenty twenty-two version 1.6
 3- Visit the home page => fatal error is there

 `[27-Nov-2023 09:57:34 UTC] PHP Fatal error:  Uncaught TypeError:
 array_key_exists(): Argument #2 ($array) must be of type array, null given
 in /.../wp-includes/block-supports/align.php:48`

 {{{
 Stack trace:
 #0 /.../wp-includes/class-wp-block-supports.php(119):
 wp_apply_alignment_support()
 #1 /.../wp-includes/class-wp-block-supports.php(176):
 WP_Block_Supports->apply_block_supports()
 #2 /.../wp-includes/blocks/site-logo.php(56):
 get_block_wrapper_attributes()
 #3 /.../wp-includes/class-wp-block.php(258): render_block_core_site_logo()
 #4 /.../wp-includes/class-wp-block.php(244): WP_Block->render()
 #5 /.../wp-includes/class-wp-block.php(244): WP_Block->render()
 #6 /.../wp-includes/class-wp-block.php(244): WP_Block->render()
 #7 /.../wp-includes/blocks.php(1484): WP_Block->render()
 #8 /.../wp-includes/blocks.php(1522): render_block()
 #9 /.../wp-includes/blocks/template-part.php(144): do_blocks()
 #10 /.../wp-includes/class-wp-block.php(258):
 render_block_core_template_part()
 #11 /.../wp-includes/blocks.php(1484): WP_Block->render()
 #12 /.../wp-includes/blocks.php(1522): render_block()
 #13 /.../wp-includes/block-template.php(260): do_blocks()
 #14 /.../wp-includes/template-canvas.php(12):
 get_the_block_template_html()
 #15 /.../wp-includes/template-loader.php(106): include('...')
 #16 /.../wp-blog-header.php(19): require_once('...')
 #17 /.../index.php(17): require('...')
 #18 {main}
   thrown in /.../wp-includes/block-supports/align.php on line 48
 }}}

 **Expected**
 No fatal error and the home page is displayed correctly

 **Note:**
 Tested on Ubuntu 23.10, Chrome Version 119.0.6045.123 (Official Build)

--

Comment (by sabernhardt):

 Somehow the `$block_attributes` variable is `null` in
 `wp_apply_alignment_support()` for your site, and the stack trace mentions
 the Site Logo block.

 [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/block-
 supports/align.php?rev=56382#L48 Line 48] could check `is_array()` before
 running `array_key_exists()`, but it would help to know how the
 `$block_attributes` can be any other type.
 {{{
 $has_block_alignment = is_array( $block_attributes ) && array_key_exists(
 'align', $block_attributes );
 }}}

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


More information about the wp-trac mailing list