WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#21350 closed defect (bug) (fixed)

Fatal error: Class '_WP_Editors' not found

Reported by: needle Owned by: azaozz
Milestone: 3.4.2 Priority: normal
Severity: normal Version: 3.4
Component: TinyMCE Keywords: has-patch
Focuses: Cc:

Description

When a theme makes use of TinyMCE on the front end and a language other than default en is chosen in wp-config.php, then WordPress 3.4.1 dies with:

Fatal error: Class '_WP_Editors' not found in /path/to/wp-includes/js/tinymce/langs/wp-langs.php on line 548.

Solution is to require the class-wp-editor.php file if not already included in function wp_mce_translation(). Patch attached.

Attachments (1)

21350.patch (430 bytes) - added by needle 3 years ago.

Download all attachments as: .zip

Change History (8)

@needle3 years ago

comment:1 @azaozz3 years ago

  • Keywords reporter-feedback added

Wondering how exactly the theme uses TinyMCE. The class is included when calling wp_editor() and tinymce/langs/wp-langs.php is not used if TinyMCE was used directly as a JS. The only call to wp-langs.php is in the _WP_Editors class.

Last edited 3 years ago by azaozz (previous) (diff)

comment:2 @needle3 years ago

  • Keywords reporter-feedback removed

In common with many themes and plugins that predate wp_editor(), the theme makes use of a customised version of wp_tiny_mce() to enable TinyMCE on the comment textarea.

A quick search shows that, for example, BP GTM System, Rich Text Widget, MCEComments, Custom Fields, Quickpress all make use of this technique as well (not sure how many of those are current though). And searching for the string "Fatal error: Class '_WP_Editors' not found" yields 53,600 results, so I suspect that many other themes and plugins haven't transitioned to wp_editor() for the comment textarea yet.

The patch would keep backwards compatibility with the above technique.

comment:4 @nacin3 years ago

  • Milestone changed from Awaiting Review to 3.4.2
  • Version changed from 3.4.1 to 3.4

comment:5 @azaozz3 years ago

So the problem is that some plugins and themes have copied code from core instead of using the API and then didn't update/maintain that code when the corresponding WP functions were updated.

In this case it's easy to fix by putting these two lines back ticket:20119:2, but thinking we should not support this in general.

comment:6 @azaozz3 years ago

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

In [21344]:

Bail out themes and plugins that have copied code from core and don't maintain it by requiring class-wp-editor.php in wp-langs.php, fixes #21350 for 3.4

comment:7 @azaozz3 years ago

In [21345]:

Bail out themes and plugins that have copied code from core and don't maintain it by requiring class-wp-editor.php in wp-langs.php, fixes #21350 for trunk

Note: See TracTickets for help on using tickets.