WordPress.org

Making WordPress.org

Opened 13 months ago

Closed 12 months ago

Last modified 12 months ago

#3704 closed defect (fixed)

Prevent Fatal Errors from Gutenberg Tweaks in WordCamp Environment

Reported by: dryanpress Owned by: coreymckrill
Milestone: Priority: high
Component: WordCamp Site & Plugins Keywords:
Cc:

Description

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 13 months ago.

Download all attachments as: .zip

Change History (4)

@dryanpress
13 months ago

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


13 months ago

#2 @coreymckrill
12 months 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
12 months 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.