Skip to content

[Webfonts] Deprecations for data structural changes filling server logs #47123

Closed

Description

@hellofromtonya

Description

Data structural deprecations are filling server logs on production sites. This can be problematic for hosting companies.

This change proposes to only throw the deprecations when WP_Debug is on. By doing so, developers testing changes will see the deprecations in their logs, but production sites will not.

How?

Use Core's _deprecated_argument() instead of trigger_error(), similar to how functions use Core's _deprecated_function().

Step-by-step reproduction instructions

  1. Register web fonts in the old way by passing an array of fonts.
  2. Run the site.
  3. Open the server logs.
  4. Notice the list of deprecations for:
PHP Deprecated: A deprecated web fonts array structure passed to wp_register_webfonts(). Variations must be grouped and keyed by their font family. in /plugins/gutenberg/14.9.1/lib/experimental/class-wp-webfonts.php on line 160

Old way of registering fonts:

wp_register_webfonts(
	array(
		array(
			'font-family'  => 'Some font',
			'font-weight'  => '100 900',
			'font-style'   => 'normal',
			'font-display' => 'fallback',
		),
		array(
			'font-family'  => 'Some font',
			'font-weight'  => '100 900',
			'font-style'   => 'italic',
			'font-display' => 'fallback',
		),
	)
);

Screenshots, screen recording, code snippet

No response

Environment info

  • Gutenberg 14.9.1

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Labels

[Priority] HighUsed to indicate top priority items that need quick attention[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions