Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#22585 closed defect (bug) (fixed)

wp_editor() gives fatal error on front-end

Reported by: itworx Owned by: ryan
Milestone: 3.5 Priority: normal
Severity: major Version: 3.5
Component: Editor Keywords: needs-unit-tests has-patch commit
Focuses: Cc:


Adding wp_editor() to theme front-end gives fatal error when media_buttons are set to true.

Fatal error: Call to undefined function is_upload_space_available() in /home/vds/public_html/clients/client1/web6/web/wp-includes/media.php on line 1274

Attachments (2)

22585.diff (1.4 KB) - added by scribu 3 years ago.
22585.2.diff (451 bytes) - added by georgestephanis 3 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 @itworx3 years ago

  • Severity changed from blocker to major

comment:3 @scribu3 years ago

  • Keywords reporter-feedback added

What exact version of WP are you using?

comment:4 @scribu3 years ago

  • Keywords reporter-feedback removed
  • Milestone changed from Awaiting Review to 3.5

Actually, it doesn't matter; I can reproduce with latest trunk.

comment:5 @scribu3 years ago

Caused by [22821].

comment:6 @scribu3 years ago

  • Keywords needs-unit-tests needs-patch added

Me thinks we should have a basic unit test for this that just checks if there are any errors, fatal or otherwise, when calling wp_editor() in the front-end.

@scribu3 years ago

comment:7 @scribu3 years ago

  • Keywords has-patch added; needs-patch removed

comment:8 @nacin3 years ago

  • Keywords commit added

This is not going to be easy to unit test, because we load all functions in unit tests. (We *could* create a group of frontend tests that run first.) That said, we should work into our workflows to test wp_editor() and all related media stuff on the frontend.

This was originally fixed in [22497] and obviously [22821] required one last function in the mix.

comment:9 @ryan3 years ago

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

In 22840:

Make is_upload_space_available() available for front end page loads. Fixes fatal error when calling wp_editor() from the front end.

Props scribu, itworx
fixes #22585

@georgestephanis3 years ago

comment:10 @georgestephanis3 years ago

Just rewrote the function for tidyness and so as to not unnecessarily save something into a variable.

comment:11 @nacin3 years ago

In 22861:

Make the return of is_upload_space_available() more obvious. props georgestephanis. see #22585.

Note: See TracTickets for help on using tickets.