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

Widgets screen: PHP notices with the legacy Recent Posts widget and possibly other legacy widgets #25910

Closed
afercia opened this issue Oct 7, 2020 · 7 comments
Labels
[Block] Legacy Widget Affects the Legacy Widget Block - used for displaying Classic Widgets [Feature] Widgets Screen The block-based screen that replaced widgets.php. [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Oct 7, 2020

Describe the bug
While testing the new Widgets screen, I noticed a blank space at the top of the admin menu:

Screenshot 2020-10-07 at 17 23 15

this space is added by the core php-error CSS class set on the body when some PHP notice/warning/error is detected. Its purpose is to make the notice/warning/error text fully visible. However, there was no output so this was a bit difficult to debug.

Turns out it happens when a Recent Posts widget is already in use.

To reproduce

  • on 5.6. trunk, active theme: Twenty Twenty
  • make sure define( 'WP_DEBUG', true ); is set in your wp-config.php file
  • deactivate the Gutenberg plugin
  • go to the legacy Widgets page and add a Recent Posts widget in the Footer TinyMCE formatting improvements #1 area
  • save
  • navigate away from the Widgets page
  • activate the Gutenberg plugin
  • go to the new Widgets screen
  • notice the space at the top of the admin menu
  • enable the Query Monitor plugin
  • see it lists 4 "Undefined index" notices related to the arguments before_widget, before_title, after_title, after_widget

Screenshot:

Screenshot 2020-10-07 at 17 13 29

I tested only with the Recent Posts widget but likely these notices are triggered also with other legacy widgets.

Expected behavior
To not have PHP notices.

Editor version (please complete the following information):

  • WordPress version: 5.6 trunk
  • Does the website has Gutenberg plugin installed, or is it using the block editor that comes by default? plugin
  • If the Gutenberg plugin is installed, which version is it? 9.1.1
@afercia afercia added [Type] Bug An existing feature does not function as intended [Feature] Widgets Screen The block-based screen that replaced widgets.php. [Block] Legacy Widget Affects the Legacy Widget Block - used for displaying Classic Widgets labels Oct 7, 2020
@afercia
Copy link
Contributor Author

afercia commented Oct 7, 2020

Props to @fklein-lu for reminding me to use Query Monitor and to @johnbillion for making it 😄

@johnbillion
Copy link
Member

johnbillion commented Oct 7, 2020

@johnbillion
Copy link
Member

Hmm no because those aren't suppressed errors. Same result, different cause.

@talldan
Copy link
Contributor

talldan commented Oct 15, 2020

I was also seeing this issue previously, but not anymore. Anyone else?

@talldan talldan added the Needs Testing Needs further testing to be confirmed. label Oct 15, 2020
@noisysocks
Copy link
Member

noisysocks commented Jan 5, 2021

I still see this whitespace locally. Not sure if it matters, but I'm running PHP 8.

@noisysocks noisysocks added [Priority] High Used to indicate top priority items that need quick attention and removed Needs Testing Needs further testing to be confirmed. labels Jan 5, 2021
@kevin940726
Copy link
Member

I'm not seeing this error on WordPress 5.6, Gutenberg 9.7.0, and following all the above reproduction steps. 🤔

@noisysocks
Copy link
Member

I am no longer able to reproduce this in trunk. Thanks for the detailed reproduction steps @afercia.

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 [Feature] Widgets Screen The block-based screen that replaced widgets.php. [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

No branches or pull requests

5 participants