Make WordPress Core

Opened 5 months ago

Closed 5 months ago

Last modified 2 months ago

#59968 closed defect (bug) (invalid)

Fatal error when access the FE with 2022 theme with WP 6.4.1

Reported by: mai21's profile mai21 Owned by:
Milestone: Priority: normal
Severity: critical Version:
Component: Themes Keywords:
Focuses: Cc:

Description (last modified by sabernhardt)

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)

Attachments (1)

Screenshot from 2023-11-27 11-57-41.png (117.4 KB) - added by mai21 5 months ago.
Home page

Download all attachments as: .zip

Change History (6)

#1 follow-up: @benniledl
5 months ago

Hi and welcome to WordPress Trac!
I cannot replicate this issue, what php version are you using and is this a fresh WordPress installation?

#2 @sabernhardt
5 months ago

  • Description modified (diff)

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

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 );

#3 in reply to: ↑ 1 @mai21
5 months ago

Replying to benniledl:

Hi and welcome to WordPress Trac!
I cannot replicate this issue, what php version are you using and is this a fresh WordPress installation?

Hi benniledl, Thank you!

It isn't a fresh installation of WP.

Here are the server details.

Server architecture Linux 5.4.0-166-generic x86_64
Web server nginx/1.24.0
PHP version 8.1.25 (Supports 64bit values)
PHP SAPI fpm-fcgi
PHP max input variables 20000
PHP time limit 300
PHP memory limit 512M
Max input time 300
Upload max filesize 100M
PHP post max size 100M
cURL version 7.68.0 OpenSSL/1.1.1f

#4 @benniledl
5 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Trac is used to track bugs of the WordPress Software, your issue does not appear to be an issue with WordPress itself but more likely a faulty plugin, theme or webserver configuration.
However there is a place to go for your issue: I recommend you to go to the WordPress support forum to get help for your problem: https://wordpress.org/support/forums/

#5 @swissspidy
2 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.