Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hellofromtonya opened this issue Jan 12, 2023 · 0 comments · Fixed by #47125
Closed

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

hellofromtonya opened this issue Jan 12, 2023 · 0 comments · Fixed by #47125
Assignees
Labels
[Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@hellofromtonya
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants