Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#3704 closed defect (bug) (fixed)

Prevent Fatal Errors from Gutenberg Tweaks in WordCamp Environment

Reported by: dryanpress's profile dryanpress Owned by: coreymckrill's profile coreymckrill
Milestone: Priority: high
Component: WordCamp Site & Plugins Keywords:


An earlier commit from @coreymckrill was meant to address this, but unfortunately doesn't prevent fatal errors:

is_plugin_active() is only available on the Admin unless the file is scoped to load on the front end.

PHP 7.2.x also fatal errors unless global namespace methods are explicitly slashed.

As a simplified approach, the gutenberg_init() method isn't available unless Gutenberg is active, and can be used to check plugin activation without requiring the file containing is_plugin_active().

Attachments (1)

3704.patch (1.3 KB) - added by dryanpress 6 years ago.

Download all attachments as: .zip

Change History (4)

6 years ago

This ticket was mentioned in Slack in #meta by dryanpress. View the logs.

6 years ago

#2 @coreymckrill
6 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 7459:

WordCamp: Avoid fatal error when Gutenberg isn't activated

is_plugin_active is usually scoped only for WP Admin, so it may not be
available when Gutenberg Tweaks is trying to determine if Gutenberg is
activated, which would throw a fatal error. Detecting the existence of a
function within the Gutenberg plugin itself is a safer option.

Fixes #3704
Props dryanpress

#3 @coreymckrill
6 years ago

Thanks @dryanpress! I wasn't able to reproduce the fatal error on my local environment, so I must be loading wp-admin/includes/plugin.php somewhere, even for front end requests. I'll take your word for it, though, and feature detection seems like a better strategy anyway.

PHP 7.2.x also fatal errors unless global namespace methods are explicitly slashed.

I wasn't aware of this, but good to know. I didn't see anything about this in various posts about changes in 7.2. Do you have a link to this info?

Note: See TracTickets for help on using tickets.