Skip to content

Bug: EE_Front_Controller::get_request() cause actions on parse_request to be skipped #4191

@jakejackson1

Description

@jakejackson1

Describe the bug
EE_Front_Controller::get_request() runs on parse_request priority 1 and for whatever reason removes itself during its execution. If another plugin adds an action on the parse_request hook with a priority 0, when EE_Front_Controller::get_request() removes itself it causes WordPress to skip the actions registered on priority 10.

To Reproduce
On a vanilla WordPress installation with no plugins activated:

  1. Set WP_DEBUG to true and WP_DEBUG_LOG to true
  2. Add the following code snippet to an MU Plugin (or similar):
add_action( 'parse_request', function($wp) {
	error_log( 'This will be logged...' );
}, 0 );

add_action( 'parse_request', function($wp) {
	error_log( 'This will be skipped when Event Espresso is activated...' );
}, 10 );
  1. Load the homepage and then review /wp-content/debug.log to verify both messages are logged
  2. Activated Event Espresso
  3. Load the homepage and check the log again. Only the first message is logged; the second has been skipped

A real-world example of this bug can be seen if you install the LifterLMS plugin alongside Event Espresso. It registers on priority 0 of parse_request and triggers the bug.

Expected behavior
All registered hooks on parse_request should execute. Could the remove_action() line be removed? If it's important to unhook this code, perhaps it could be delayed until after parse_request completes, or on a very late priority 9999?

Environment:

  • Version of Event Espresso: 5.0.37.decaf and 5.0.45
  • Version of WordPress: 6.8.2
  • Browser: any
  • PHP Version 8.1, 8.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions