[wp-trac] [WordPress Trac] #58167: PHP Notice in wp-includes/class-wp-block-supports.php
WordPress Trac
noreply at wordpress.org
Tue Aug 8 19:46:00 UTC 2023
#58167: PHP Notice in wp-includes/class-wp-block-supports.php
-------------------------------------------+------------------------------
Reporter: laurencebahiirwa | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.2
Severity: normal | Resolution:
Keywords: php81 close reporter-feedback | Focuses:
-------------------------------------------+------------------------------
Changes (by hellofromTonya):
* keywords: php81 => php81 close reporter-feedback
Comment:
Hello @laurencebahiirwa,
Welcome back to Core's Trac!
The function `get_block_wrapper_attributes()` requires an `array`, more
specifically an `array` of `strings`. It's optional and thus set to an
empty `array()` if nothing is passed to it. This means something is
passing something other than an `array` data type.
You mentioned it only happens with a custom block. In that custom block,
is it calling `get_block_wrapper_attributes()`? And if yes, what data type
is it passing to it? The check for `null` should be done in the plugin /
theme adding the custom block.
>Would it be redundant to add an if check for this on
https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-
block-supports.php#L204-L208?
As the function requires an `array`, yes, it would be redundant. That
said, there is/will be an architectural discussion to determine if a
structured approach needs to happen for input (parameter) validation. But
that discussion is across all of Core, rather than in just this function.
I'll mark this ticket as a `close` candidate with the assumption that a
custom block is incorrectly calling `get_block_wrapper_attributes()` with
something other than an `array`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58167#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list