[wp-trac] [WordPress Trac] #57777: Twenty Twenty: Deprecation warnings on PHP 8.1 because of `wp_add_inline_style()`

WordPress Trac noreply at wordpress.org
Tue Feb 21 09:15:46 UTC 2023


#57777: Twenty Twenty: Deprecation warnings on PHP 8.1 because of
`wp_add_inline_style()`
---------------------------+--------------------
 Reporter:  swissspidy     |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  6.2
Component:  Bundled Theme  |    Version:
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+--------------------
 Currently running 6.2-beta2-55368 on PHP 8.1 and getting the following
 deprecation notice when opening the block editor:

 `Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type
 string is deprecated in /../wp-includes/functions.wp-styles.php`

 This is caused by the `twentytwenty_block_editor_styles()` function which
 calls

 `wp_add_inline_style( $handle = 'twentytwenty-block-editor-styles', $data
 = NULL )`.

 I see two problematic calls, though the latter one :

 https://github.com/WordPress/wordpress-
 develop/blob/072274690b52cfa0c5e5da763e70a7af24f00da7/src/wp-
 content/themes/twentytwenty/functions.php#L426-L430

 - `twentytwenty_get_customizer_css()` can return `false` - not exactly a
 valid param to `wp_add_inline_style`
 - `TwentyTwenty_Non_Latin_Languages::get_non_latin_css()` returns `void`
 <- this is the more severe issue as this means `$data` is `null`

 Both instances should be fixed imo.

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


More information about the wp-trac mailing list