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

Error messages are displayed in legacy widgets in 5.8beta1 #32624

Closed
piotrbak opened this issue Jun 11, 2021 · 4 comments · Fixed by #32854
Closed

Error messages are displayed in legacy widgets in 5.8beta1 #32624

piotrbak opened this issue Jun 11, 2021 · 4 comments · Fixed by #32854
Labels
[Block] Legacy Widget Affects the Legacy Widget Block - used for displaying Classic Widgets [Type] Bug An existing feature does not function as intended

Comments

@piotrbak
Copy link

piotrbak commented Jun 11, 2021

Description

When there's an error happening while block editor is loaded + debug log is enabled, we're displaying the error in each instance of legacy widgets.

Step-by-step reproduction instructions

  1. Enable debug log, set WP_DEBUG_DISPLAY to true
  2. Install Imagify and Yoast
  3. Make sure there are some legacy widgets
  4. Go to the Widgets section
  5. See errors present in each widget section

Expected behaviour

Errors shouldn't be printed there

Actual behaviour

Errors are being repeated in each instance of widgets, they're disappearing when clicking on the widget

Screenshots or screen recording (optional)

image
https://jmp.sh/JzVG8SS

WordPress information

  • WordPress version: 5.8-beta1-51137
  • Gutenberg version: Not installed
  • Are all plugins except Gutenberg deactivated? No
  • Are you using a default theme (e.g. Twenty Twenty-One)? No

Device information

  • Device: Desktop
  • Operating system: Windows 10
  • Browser: Chrome
@talldan talldan added the [Block] Legacy Widget Affects the Legacy Widget Block - used for displaying Classic Widgets label Jun 14, 2021
@noisysocks noisysocks added the Needs Testing Needs further testing to be confirmed. label Jun 15, 2021
@draganescu
Copy link
Contributor

I tested this and it's as described. Just installing Imagify and Yoast (no configuration just activation) creates errors. If some plugin causes an error:

a) without WP_DEBUG

Screen Shot 2021-06-16 at 12 08 50

b) with WP_DEBUG

Screen Shot 2021-06-16 at 12 09 57

I wonder what we should do though? The errors are legit. Should the rendering endpoing :hack: the errors out of the response?

@draganescu draganescu added [Type] Enhancement A suggestion for improvement. [Type] Question Questions about the design or development of the editor. Needs Design Feedback Needs general design feedback. Needs Technical Feedback Needs testing from a developer perspective. and removed Needs Testing Needs further testing to be confirmed. labels Jun 16, 2021
@noisysocks
Copy link
Member

I'm surprised to see that get_current_screen is undefined. Perhaps intercepting the iframe request in init is too early. We need to intercept the request before headers are sent but after most of WordPress has loaded.

add_action( 'init', 'handle_legacy_widget_preview_iframe', 21 );

@noisysocks noisysocks added [Type] Bug An existing feature does not function as intended and removed Needs Design Feedback Needs general design feedback. Needs Technical Feedback Needs testing from a developer perspective. [Type] Question Questions about the design or development of the editor. [Type] Enhancement A suggestion for improvement. labels Jun 17, 2021
@adamziel
Copy link
Contributor

adamziel commented Jun 18, 2021

admin_init perhaps? get_current_screen seems to be defined in src/wp-admin/includes/screen.php which is included in wp-admin/includes/admin.php; It seems like I need to upgrade my local setup to actually try this though as it seems to be going through core PHP files, not the ones in my Gutenberg plugin

@adamziel
Copy link
Contributor

I proposed a fix in #32854

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Legacy Widget Affects the Legacy Widget Block - used for displaying Classic Widgets [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants