• Resolved sdunhamsc

    (@sdunhamsc)


    I’ve run into what appears to be a bug with the 6.0.5 version of The Events Calendar. This is the error being thrown:

    PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function TEC\Events\Custom_Tables\V1\WP_Query\Custom_Tables_Query::filter_found_posts_query(), 1 passed in /app/wp/wp-includes/class-wp-hook.php on line 308 and exactly 2 expected in /app/wp/wp-content/plugins/the-events-calendar/src/Events/Custom_Tables/V1/WP_Query/Custom_Tables_Query.php:575

    From what I can tell by looking at both the plugin and WP core code, the reason for this error is that the found_posts_query filter being used to call Custom_Tables_Query::filter_found_posts_query passes its arguments in a single array, but the method in your class expects there to be 2 separate arguments passed.

    I can confirm I get this error with the 6.0.5 version of the plugin, but not with the 6.0.3.1 version.

    I did some local testing, and believe this should fix the issue:

    Change the method from:

    public function filter_found_posts_query( $found_posts_query, $query ) {
        // Rest of your method here
    }

    to:

    public function filter_found_posts_query( $args ) {
        [$found_posts_query, $query] = $args;
        // Rest of your method here
    }
    • This topic was modified 3 years, 5 months ago by sdunhamsc.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support WilloftheD

    (@abzlevelup)

    Hi @sdunhamsc, I appreciate you sharing and providing more details here.

    You’re correct that the
    Custom_Tables_Query::filter_found_posts_query method/function takes two arguments and has a signature
    public function filter_found_posts_query( $found_posts_query, $query ). However, I am curious if there is another plugin that’s calling the same filter and might not be passing the required arguments.

    By any chance, can you provide the entire/full stack trace of the error here? This is for us to pinpoint where the issue is coming from.

    Appreciate you bringing this to our attention. Looking forward to hearing from you.

    Best,
    Abz

    Plugin Support WilloftheD

    (@abzlevelup)

    This thread has been inactive for a while, so we’ll go ahead and mark it Resolved. Please feel free to open a new thread if any other questions come up, and we’d be happy to help.

    Thread Starter sdunhamsc

    (@sdunhamsc)

    Sorry for not replying, this fell off my radar for a bit. It turns out that the issue I was running into was indeed being caused by another plugin (PublishPress Permissions Pro), and the issue is on their radar to address. Sorry for opening a ticket for something that wasn’t related to your plugin!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Error related to found_posts_query filter usage’ is closed to new replies.