Make WordPress Core

Opened 11 months ago

Closed 9 months ago

Last modified 9 months ago

#59892 closed defect (bug) (fixed)

Deprecated print_emoji_styles produced during embed

Reported by: bobbingwide's profile bobbingwide Owned by: jorbin's profile jorbin
Milestone: 6.4.3 Priority: normal
Severity: normal Version: 6.4
Component: Embeds Keywords: has-testing-info has-patch has-unit-tests fixed-major dev-reviewed
Focuses: Cc:

Description

print_emoji_styles was deprecated in WordPress 6.4.0.
When WP_DEBUG is true in the target server, then the deprecated message can be issued during embed processing. This is returned to the browser and displayed in both the block editor and the front end.

Deprecated: Function print_emoji_styles is deprecated since version 6.4.0! Use wp_enqueue_emoji_styles instead. in wp-includes\functions.php on line 6031

Trace output from the server

\wp-content\plugins\oik-bwtrace\includes\bwtrace-actions.php(186:2) bw_trace_deprecated_function_run(1) 37 1 2023-11-12T09:59:28+00:00 1.774142 0.000396 cf=embed_head,wp_print_styles,deprecated_function_run 21 2 50331648/50331648 256M F=512 3 Array

[0] => (string) "print_emoji_styles"
[1] => (string) "wp_enqueue_emoji_styles"
[2] => (string) "6.4.0"

  1. bw_lazy_backtrace \wp-content\plugins\oik-bwtrace\libs\bwtrace.php:108 0
  2. bw_backtrace \wp-content\plugins\oik-bwtrace\includes\bwtrace-actions.php:187 0
  3. bw_trace_deprecated_function_run(print_emoji_styles,wp_enqueue_emoji_styles,6.4.0) \wp-includes\class-wp-hook.php:324 3
  4. apply_filters(,array) \wp-includes\class-wp-hook.php:348 2
  5. do_action(array) \wp-includes\plugin.php:517 1
  6. do_action(deprecated_function_run,print_emoji_styles,wp_enqueue_emoji_styles,6.4.0) \wp-includes\functions.php:5456 4
  7. _deprecated_function(print_emoji_styles,6.4.0,wp_enqueue_emoji_styles) \wp-includes\deprecated.php:5905 3
  8. print_emoji_styles() \wp-includes\class-wp-hook.php:324 1
  9. apply_filters(,array) \wp-includes\class-wp-hook.php:348 2
  10. do_action(array) \wp-includes\plugin.php:517 1
  11. do_action(wp_print_styles) \wp-includes\functions.wp-styles.php:57 1
  12. wp_print_styles() \wp-includes\class-wp-hook.php:324 1
  13. apply_filters(array,array) \wp-includes\class-wp-hook.php:348 2
  14. do_action(array) \wp-includes\plugin.php:517 1
  15. do_action(embed_head) \wp-includes\theme-compat\header-embed.php:29 1
  16. require_once(\wp-includes\theme-compat\header-embed.php) \wp-includes\template.php:790 1
  17. load_template(/wp-includes/theme-compat/header-embed.php,1,array) \wp-includes\template.php:725 3
  18. locate_template(array,1,1,array) \wp-includes\general-template.php:48 4
  19. get_header(embed) \wp-includes\theme-compat\embed.php:13 1
  20. include(\wp-includes\theme-compat\embed.php) \wp-includes\template-loader.php:106 1
  21. require_once(\wp-includes\template-loader.php) \wp-blog-header.php:19 1
  22. require(\wp-blog-header.php) \index.php:17 1

Steps to reproduce

Using a fresh install

  1. Set WP_DEBUG to true in target server
  2. Add a post
  3. Embed the sample page eg https://example.com/sample-page/
  4. The Deprecated message will appear in the block editor.
  5. Save
  6. View post
  7. When the embedding is run the deprecated message appears in the front end.

Notes

Attachments (1)

TestReport-59892-reproduce-issue.png (129.2 KB) - added by hellofromTonya 11 months ago.
Test Report: Can reproduce the reported issue.

Download all attachments as: .zip

Change History (18)

@hellofromTonya
11 months ago

Test Report: Can reproduce the reported issue.

#1 @hellofromTonya
11 months ago

Reproduction Report

This report validates that the issue can be reproduced.

Environment

  • OS: macOS Sonoma 14.1.1
  • Web Server: Nginx
  • PHP: 7.4.30
  • WordPress: 6.4.1
  • Browser: Firefox 120.0
  • Theme: Twenty Twenty-Four
  • Active Plugins: None

Steps to Reproduce

  1. Open the Sample Page in the frontend.
  2. Copy its URL.
  3. Open or create a new post.
  4. In the content, add an Embed block.
  5. Paste the "Same Page" URL into the text field.
  6. Select the "Embed" button.
  7. 🐞 Bug occurs.
  8. Save or update the post.
  9. Refresh the page.
  10. Same 🐞 bug occurs.
  11. Check your server logs. The deprecation is listed.

Actual Results

  • ✅ Error condition occurs (reproduced).

Supplemental Artifacts

TestReport-59892-reproduce-issue.png

#2 @hellofromTonya
11 months ago

  • Keywords has-testing-info added
  • Milestone changed from Awaiting Review to 6.4.2

Hello @bobbingwide,

Welcome back to WordPress Core's Trac :) Thank you for sharing such detailed information. This kind of information is invaluable to help contributors investigate, find the root cause, and resolve it.

I am able to reproduce the issue.

Hmm, I wonder .. Why/how is the Embed block and the embed functionality triggering the print_emoji_styles()? @bobbingwide provided a backtrace.

Next step is trace to find what and where is invoking print_emoji_styles() in this scenario. From there, can determine if this needs to be fixed in Core or Gutenberg.

Moving it into 6.4.2 for further investigation.

#3 @bobbingwide
10 months ago

I'd have a second review of the changes implemented in https://github.com/WordPress/WordPress/commit/72f19abd94fa1860ebd4c69f1a887765b97a397d
and see whether or not the actions being invoked by embed are being run in the order expected by the solution that removes the hooks and adds them again.

#4 @SergeyBiryukov
10 months ago

  • Milestone changed from 6.4.2 to 6.4.3

This ticket was mentioned in Slack in #core by jorbin. View the logs.


10 months ago

#6 @jorbin
9 months ago

#60260 was marked as a duplicate.

This ticket was mentioned in PR #5871 on WordPress/wordpress-develop by @peterwilsoncc.


9 months ago
#7

  • Keywords has-patch has-unit-tests added

Initial push is just the tests.

https://core.trac.wordpress.org/ticket/59892

#8 @peterwilsoncc
9 months ago

In the linked pull request:

  • Add the print_emoji_styles back to the unit tests
  • Enqueue the emoji styles for embed templates.

The tests are passing now the functional commit has been pushed.

#9 @jorbin
9 months ago

  • Owner set to jorbin
  • Resolution set to fixed
  • Status changed from new to closed

In 57306:

Embeds: Ensure the deprecated function print_emoji_styles isn't used

Ensure that the proper new function wp_enqueue_emoji_styles is used in embeds.

Follow-up to: [56194].

Props peterwilsoncc, bobbingwide, hellofromTonya.
Fixes #59892. See: #58775.

#10 @jorbin
9 months ago

  • Keywords dev-feedback added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for consideration of [57306] to be backported to the 6.4 branch.

This ticket was mentioned in Slack in #core by jorbin. View the logs.


9 months ago

#13 @swissspidy
9 months ago

  • Keywords fixed-major added

This ticket was mentioned in Slack in #core by jorbin. View the logs.


9 months ago

#15 @davidbaumwald
9 months ago

  • Keywords dev-reviewed added; dev-feedback removed

Tested this in the 6.4 branch before and after the PR. Deprecation is not displayed after the patch. Good to backport to the 6.4 branch.

#16 @jorbin
9 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 57347:

Embeds: Ensure the deprecated function print_emoji_styles isn't used

Ensure that the proper new function wp_enqueue_emoji_styles is used in embeds.

Follow-up to: [56194].

Reviewed by davidbaumwald.
Merges [57306] to the 6.4 branch.

Props peterwilsoncc, bobbingwide, hellofromTonya.
Fixes #59892. See: #58775.

#17 @ugyensupport
9 months ago

Deprecated print_emoji_styles produced during embed

Description

print_emoji_styles was deprecated in WordPress 6.4.0.
When WP_DEBUG is true in the target server, then the deprecated message can be issued during embed processing. This is returned to the browser and displayed in both the block editor and the front end.
Deprecated: Function print_emoji_styles is deprecated since version 6.4.0! Use wp_enqueue_emoji_styles instead. in wp-includes\functions.php on line 6031

Environment

  • WordPress: 6.4.3-RC1
  • PHP: 8.0.0
  • Server: Apache/2.4.10 (Debian)
  • Database: mysqli (Server: 5.5.59-MariaDB-1~wheezy / Client: 5.5.62)
  • Browser: Chrome 121.0.0.0 (macOS)
  • Theme: Twenty Twenty-Four 1.0
  • MU-Plugins: None activated
  • Plugins:
    • WordPress Beta Tester 3.5.5

Steps to Reproduce

  1. Open the Sample Page in the frontend. Copy its URL.
  2. Open or create a new post.
  3. In the content, add an Embed block.
  4. Paste the "Same Page" URL into the text field.
  5. Select the "Embed" button.

🐞 Bug occurs.

  1. Save or update the post.
  2. Refresh the page. Same 🐞 bug occurs. Check your server logs. The deprecation is listed.

Expected Results

  1. ✅ Deprecation is not displayed after the patch

Actual Results

  1. https://ibb.co/H45TtNK ( WordPress 6.4.3 RC 1 )
Note: See TracTickets for help on using tickets.