#56799 closed defect (bug) (fixed)
PHP notice in class-wp-block-supports.php
Reported by: | petitphp | Owned by: | hellofromTonya |
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | normal | Version: | 6.1 |
Component: | Editor | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
On Core trunk with the TwentyTwentyThree theme with debug mode, a notice is visible on the frontend :
Notice: Undefined index: attrs in /var/www/src/wp-includes/class-wp-block-supports.php on line 97
This come from the WP_Block_Supports::apply_block_supports
method which expect the block data to contain an attrs
key :
public function apply_block_supports() { $block_attributes = self::$block_to_render['attrs']; $block_type = WP_Block_Type_Registry::get_instance()->get_registered( self::$block_to_render['blockName'] ); ...
Change History (10)
This ticket was mentioned in Slack in #core by petitphp. View the logs.
2 years ago
This ticket was mentioned in PR #3442 on WordPress/wordpress-develop by petitphp.
2 years ago
#3
- Keywords has-patch added
Trac ticket: https://core.trac.wordpress.org/ticket/56799
This ticket was mentioned in Slack in #core by desrosj. View the logs.
2 years ago
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
2 years ago
#7
@
2 years ago
To add more context, this seem to come from the core/page-list
block which doesn't declare any attributes. That seem to cause the self::$block_to_render
to not contain a key attrs
in the PHP side.
This in turn was causing a warning in wp-includes/block-supports/custom-classname.php
, reported in #56801.
The proposed fix add a check for the key and use an empty array has the default value if it doesn't exist.
#8
@
2 years ago
- Component changed from General to Editor
- Keywords commit added
- Owner set to hellofromTonya
- Status changed from new to reviewing
I am able to reproduce the reported issue. The PR resolves the issue and is ready for commit. Self-assigning. Will commit shortly.
hellofromtonya commented on PR #3442:
2 years ago
#10
Committed via changeset https://core.trac.wordpress.org/changeset/54498. Thank you @petitphp for your contribution!
Moving to the milestone for investigation.