• Resolved agilewarejustin

    (@agilewarejustin)


    Using PHP 8.0 and wp CLI to execute cron from shell. With the Event Tickets, 5.13.1

    Copy of command and stack trace below.

    wp --user=cron --url=https://www.test.org.au --path=/home/test/public_html cron event run --due-now

    Fatal error: Uncaught ArgumentCountError: Too few arguments to function TEC\Tickets\Flexible_Tickets\WP_Cli::maybe_disable_foreign_key_checks(), 0 passed in /home/test/.composer/vendor/wp-cli/wp-cli/php/class-wp-cli.php on line 304 and exactly 1 expected in /home/test/public_html/wp-content/plugins/event-tickets/src/Tickets/Flexible_Tickets/WP_Cli.php:70

    Stack trace:

    #0 /home/test/.composer/vendor/wp-cli/wp-cli/php/class-wp-cli.php(304): TEC\Tickets\Flexible_Tickets\WP_Cli->maybe_disable_foreign_key_checks()

    #1 /home/test/.composer/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(349): WP_CLI::do_hook('\''before_run_comm...'\'')

    #2 /home/test/.composer/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(394): WP_CLI\Runner->run_command(Array, Array)

    #3 /home/test/.composer/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1160): WP_CLI\Runner->run_command_and_exit()

    #4 /home/test/.composer/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()

    #5 /home/test/.composer/vendor/wp-cli/wp-cli/php/bootstrap.php(74): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))

    #6 /home/test/.composer/vendor/wp-cli/wp-cli/php/wp-cli.php(27): WP_CLI\bootstrap()

    #7 /home/test/.composer/vendor/wp-cli/wp-cli/php/boot-fs.php(17): require_once('\''/home/test/...'\'')

    #8 {main}

    thrown in /home/test/public_html/wp-content/plugins/event-tickets/src/Tickets/Flexible_Tickets/WP_Cli.php on line 70

    Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support tristan083

    (@tristan083)

    Hi @agilewarejustin ,

    Thank you for reaching out.

    Regrettably, I have not been able to reproduce this error in my testing environment running only The Events Calendar Version 6.6.1 and Event Tickets Version 5.13.1 plugin (see: https://pasteboard.co/Jh5FN1W0lThq.png) on a WordPress 6.6.1 environment.

    That said, I suspect there’s a conflict that’s causing the issue here. It would be good to test for conflicts. Could you follow the following steps?

    1. Deactivate all other plugins except for The Events Calendar Plugins.
    2. Switching to the Default theme.

    Please read the Testing for Conflicts Article before doing anything. 

    To be safe, we’d recommend conducting tests and updates on a Staging Server. Also, please keep a working backup of your website.

    Plugin Support Darian

    (@d0153)

    Hi @agilewarejustin

    It seems like this thread has been quiet for a bit, so we’ll go ahead and mark it as resolved. However, if any further questions or concerns come up, please don’t hesitate to start a new thread.

    Thread Starter agilewarejustin

    (@agilewarejustin)

    For whatever reason, no arguments are being passed to the maybe_disable_foreign_key_checks function when by the before_run_command WP-CLI hook, https://github.com/wp-cli/wp-cli/blob/main/php/class-wp-cli.php#L238C8-L238C26

            public function maybe_disable_foreign_key_checks( array $args ): bool {
    if ( ! ( $args[0] === 'site' && $args[1] === 'empty' ) ) {
    return false;
    }
    global $wpdb;
    $wpdb->query( 'SET FOREIGN_KEY_CHECKS=0;' );

    return true;
    }

    However, checking if no arguments have been passed, guarding against this problem fixes the issue.

    Below is the updated code.

          public function maybe_disable_foreign_key_checks( array $args = [] ): bool {
    if (empty($args) || $args[0] !== 'site' || $args[1] !== 'empty') {
    return false;
    }
    global $wpdb;
    $wpdb->query( 'SET FOREIGN_KEY_CHECKS=0;' );

    return true;
    }

    Plugin Support tristan083

    (@tristan083)

    Hi @agilewarejustin ,

    Thank you for your message and the information. I’ll be sure to share your feedback and your recommended fix with our product management team.

    Plugin Support Darian

    (@d0153)

    Hi @agilewarejustin

    One of my colleagues suggested disabling the foreign key checks before running the command and then turning them back on afterwards:

    See example:

    wp db query "SET FOREIGN_KEY_CHECKS=0;" --url=https://www.test.org.au --
    path=/home/test/public_html

    wp --user=cron --url=https://www.test.org.au --path=/home/test/public_html cron event run --due-now

    wp db query "SET FOREIGN_KEY_CHECKS=1;" --url=https://www.test.org.au --path=/home/test/public_html

    As always, please test it first on a staging site before applying to your live site.

    Thread Starter agilewarejustin

    (@agilewarejustin)

    A better solution is to fix the code as indicated previously.

    Until that happens, then disabling the Event Tickets plugin for cron jobs will work going forward.

    wp --user=cron --url=https://www.test.org.au --path=/home/test/public_html --skip-plugins=event-tickets cron event run --due-now
    Plugin Support Darian

    (@d0153)

    Hi @agilewarejustin

    Thank you for providing your input. I want to assure you that your feedback will be shared with the rest of the team for their review. Meanwhile, we have generated an internal ticket [TECTRIA-312] dedicated to resolving this issue. I have also included your specific use case in the ticket to ensure that it is communicated effectively to our team.

    We prioritize bugs by taking into consideration the number of users impacted as well as how the bug impacts one’s ability to run an event/sell tickets. I don’t have a specific timeline as to when this issue will be resolved, but trust that our team is aware. Our team communicates updates and bug fixes in our newsletter and via our changelog.

    I’m happy to help if any other questions are coming up around this topic, otherwise I’ll go ahead and close this ticket.

    Thanks again for reporting this issue and for using The Events Calendar! Have a great day.

    Internal Bug Ticket Reference: TECTRIA-312

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.