Automattic / Automattic/syntaxhighlighter

PHP Notice: wp_enqueue_script() was called <strong>incorrectly</strong>.

Open
#234 1 comment 0 reactions 0 assignees View on GitHub
[Type] Bug
Dominant language
CSS
Stars
251
Forks
81
PR merge metrics
No merged PRs in 30d

Description

### Steps to Reproduce
1. Enable WordPress Debug
2. Activate a Non-FSE theme
3. Go to _Apperiance > Widgets_
4. Add a new _SyntaxHighlighter Evolved_ widget
5. Check debug Log

### What I Expected
- No errors or notices in the debug log

### What Happened Instead

- Got the following PHP notice message

```
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/rav/Local Sites/bp-syntaxhighlighter-evolved/app/public/wp-includes/functions.php on line 5768
[25-Mar-2022 08:41:12 UTC] PHP Stack trace:
[25-Mar-2022 08:41:12 UTC] PHP 1. {main}() /Users/rav/Local Sites/bp-syntaxhighlighter-evolved/app/public/wp-admin/widgets.php:0
[25-Mar-2022 08:41:12 UTC] PHP 2. require() /Users/rav/Local Sites/bp-syntaxhighlighter-evolved/app/public/wp-admin/widgets.php:32
[25-Mar-2022 08:41:12 UTC] PHP 3. require_once() /Users/rav/Local Sites/bp-syntaxhighlighter-evolved/app/public/wp-admin/widgets-form-blocks.php:69
[25-Mar-2022 08:41:12 UTC] PHP 4. do_action() /Users/rav/Local Sites/bp-syntaxhighlighter-evolved/app/public/wp-admin/admin-header.php:163
[25-Mar-2022 08:41:12 UTC] PHP 5. WP_Hook->do_action() /Users/rav/Local Sites/bp-syntaxhighlighter-evolved/app/public/wp-includes/plugin.php:474
[25-Mar-2022 08:41:12 UTC] PHP 6. WP_Hook->apply_filters() /Users/rav/Local Sites/bp-syntaxhighlighter-evolved/app/public/wp-includes/class-wp-hook.php:331
[25-Mar-2022 08:41:12 UTC] PHP 7. wp_check_widget_editor_deps() /Users/rav/Local Sites/bp-syntaxhighlighter-evolved/app/public/wp-includes/class-wp-hook.php:307
[25-Mar-2022 08:41:12 UTC] PHP 8. _doing_it_wrong() /Users/rav/Local Sites/bp-syntaxhighlighter-evolved/app/public/wp-includes/widgets.php:2090
[25-Mar-2022 08:41:12 UTC] PHP 9. trigger_error() /Users/rav/Local Sites/bp-syntaxhighlighter-evolved/app/public/wp-includes/functions.php:5768
```

### PHP / WordPress / SyntaxHighlighter Evolved version

- PHP 7.4.1
- WordPress 5.9.2
- Theme: Twenty Twenty v1.9
- SyntaxHighlighter Evolved 3.6.1

### Browser / OS version

- N/A

### Context / Source

- https://wordpress.org/support/topic/notice-wp_enqueue_script-in-wordpess-5-8/#post-15492793

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the notice in WordPress 5.9.2 by enabling debug, activating a non-FSE theme, and adding a SyntaxHighlighter Evolved widget from Appearance > Widgets. Trace the plugin's widget-editor script enqueue path alongside wp_check_widget_editor_deps(). Done means the widget loads without the wp-editor notice and the debug log remains clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.