PopupMaker/Popup-Maker

PHP Notice: wp_enqueue_script() was called incorrectly

marklchaves opened this issue · 1 comments

Describe the bug

The following PHP notice gets logged when WP_DEBUG is on, Popup Maker is the only active plugin, and you're on the widgets.php admin page.

OP: https://wordpress.org/support/topic/error-on-widgets-php-with-wp_enqueue_script/

I've also reprex on my local test env using plugin-safe-mode.

https://twenty-twentyone.local/wp-admin/widgets.php?safe_mode=true&p1=popup-maker

Site information

Popup Maker version: 1.16.7

WordPress version: 5.9.3

PHP version: 8.0.12

Expected behavior

There should not be any PHP notices logged when on the widgets.php admin page.

Current behavior

Steps to reproduce

  1. Turn on WP_DEBUG.
  2. Disable all plugins except Popup Maker (optionally switch to the Twenty Twenty-One theme).
  3. Visit /wp-admin/ > Appearance > Widgets.
  4. View your debug.log.

Errors

debug.log

[07-Apr-2022 10:46:42 UTC] PHP Notice: wp_enqueue_script() was called incorrectly. "wp-editor" script should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets). Please see Debugging in WordPress for more information. (This message was added in version 5.8.0.) in /Users/markchaves/Local Sites/twenty-twentyone/app/public/wp-includes/functions.php on line 5775
[07-Apr-2022 10:46:42 UTC] PHP Stack trace:
[07-Apr-2022 10:46:42 UTC] PHP 1. {main}() /Users/markchaves/Local Sites/twenty-twentyone/app/public/wp-admin/widgets.php:0
[07-Apr-2022 10:46:42 UTC] PHP 2. require() /Users/markchaves/Local Sites/twenty-twentyone/app/public/wp-admin/widgets.php:32
[07-Apr-2022 10:46:42 UTC] PHP 3. require_once() /Users/markchaves/Local Sites/twenty-twentyone/app/public/wp-admin/widgets-form-blocks.php:69
[07-Apr-2022 10:46:42 UTC] PHP 4. do_action() /Users/markchaves/Local Sites/twenty-twentyone/app/public/wp-admin/admin-header.php:163
[07-Apr-2022 10:46:42 UTC] PHP 5. WP_Hook->do_action() /Users/markchaves/Local Sites/twenty-twentyone/app/public/wp-includes/plugin.php:474
[07-Apr-2022 10:46:42 UTC] PHP 6. WP_Hook->apply_filters() /Users/markchaves/Local Sites/twenty-twentyone/app/public/wp-includes/class-wp-hook.php:331
[07-Apr-2022 10:46:42 UTC] PHP 7. wp_check_widget_editor_deps() /Users/markchaves/Local Sites/twenty-twentyone/app/public/wp-includes/class-wp-hook.php:307
[07-Apr-2022 10:46:42 UTC] PHP 8. _doing_it_wrong() /Users/markchaves/Local Sites/twenty-twentyone/app/public/wp-includes/widgets.php:2090
[07-Apr-2022 10:46:42 UTC] PHP 9. trigger_error() /Users/markchaves/Local Sites/twenty-twentyone/app/public/wp-includes/functions.php:5775

Additional context

Resolved in develop