[wp-trac] [WordPress Trac] #58167: PHP Notice in wp-includes/class-wp-block-supports.php

WordPress Trac noreply at wordpress.org
Thu Apr 20 15:15:32 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            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 I am using PHP 8.1.9
 Default theme TwentyTwentyThree

 The first notice could have been already reported:

 `PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject)
 of type array|string is deprecated in wp-includes/functions.php on line
 2165`

 However, this is new and comes when a page with a custom block is used.

 `PHP Warning:  foreach() argument must be of type array|object, string
 given in wp-includes/class-wp-block-supports.php on line 204`

 In as much as the function `get_block_wrapper_attributes` has type
 hinting,
 See: https://github.com/WordPress/WordPress/blob/master/wp-includes/class-
 wp-block-supports.php#L175

 `get_block_wrapper_attributes( $extra_attributes = array() ) {`

 The error still shows up. 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?

 I have tried this locally and the error is no more. I would happy to
 submit a patch if this is viable.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58167>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list