I noticed that the sites weren’t syncing per the set schedule and the regular WP cron tasks weren’t running. So I tried to trigger them manually using wp-cli.
With the MainWP plugin activated there was a fatal error reported, and when I disabled the plugin the cron tasks ran properly.
The error output of the cli shows an unexpected => in class-mainwp-rest-controller.php on line 1522 here’s the cli copy/paste with annotations in [ ].
C:\Hosted\ControlPanel>c:\wp-cli\wp cron event run --due-now
Parse error: syntax error, unexpected ‘=>’ (T_DOUBLE_ARROW), expecting ‘)’ in C:\Hosted\ControlPanel\wp-content\plugins\mainwp\includes\rest-api\controller\version2\class-mainwp-rest-controller.php on line 1522
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.
[Here I disabled the MainWP plugin]
C:\Hosted\ControlPanel>c:\wp-cli\wp cron event run --due-now
Executed the cron event ‘fluentmail_do_daily_scheduled_tasks’ in 0.143s.
Executed the cron event ‘wp_version_check’ in 2.864s.
Executed the cron event ‘wp_version_check’ in 0.021s.
Executed the cron event ‘wp_privacy_delete_old_export_files’ in 0.031s.
Executed the cron event ‘wordfence_version_check’ in 0.007s.
Executed the cron event ‘wordfence_ls_ntp_cron’ in 0.014s.
Executed the cron event ‘wordfence_daily_cron’ in 0.02s.
Executed the cron event ‘wordfence_hourly_cron’ in 0.014s.
Executed the cron event ‘wp_update_plugins’ in 0.035s.
Executed the cron event ‘wp_update_themes’ in 0.018s.
Executed the cron event ‘fluentmail_do_daily_scheduled_tasks’ in 0.023s.
Executed the cron event ‘wp_update_user_counts’ in 0.015s.
Executed the cron event ‘recovery_mode_clean_expired_keys’ in 0.015s.
Executed the cron event ‘wp_scheduled_delete’ in 0.103s.
Executed the cron event ‘delete_expired_transients’ in 0.262s.
Executed the cron event ‘wp_scheduled_auto_draft_delete’ in 0.022s.
Executed the cron event ‘wordfence_completeCoreUpdateNotification’ in 0.007s.
Success: Executed a total of 17 cron events.
[Here I re-enabled the MainWP plugin]
C:\Hosted\ControlPanel>c:\wp-cli\wp cron event run --due-now
Parse error: syntax error, unexpected ‘=>’ (T_DOUBLE_ARROW), expecting ‘)’ in C:\Hosted\ControlPanel\wp-content\plugins\mainwp\includes\rest-api\controller\version2\class-mainwp-rest-controller.php on line 1522
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.
C:\Hosted\ControlPanel>
Can somebody take a look at the controller and try to fix it, because I suspect this will be breaking a lot of people’s sites functionality.
I am running WP 6.9.4 (En_AU) with PHP 8.5.1 on IIS 8.0.
The only active plugins are FluentSMTP (for emails), MainWP Dashboard, and WP Control (to debug the cron issues and see tasks run times). There are no other security or WAF plugins installed.
We weren’t able to reproduce this on our side.
The code in class-mainwp-rest-controller.php is syntactically valid on supported PHP versions, and the reported unexpected ‘=>’ points to arrow-function syntax that requires PHP 7.4+.
Could you please run the following commands from the same terminal session where wp cron event run --due-now fails and send us the full output?
Thanks for getting back to me. The issue is resolved, while the web server was running PHP 8.5.1 the cli had an old environment variable still in the path and was using PHP 7.3. I Updated the path and the cli now runs properly.
C:\Hosted\ControlPanel>c:\wp-cli\wp cron event run --due-now
Executed the cron event 'fluentmail_do_daily_scheduled_tasks' in 0.06s.
Executed the cron event 'mainwp_cronupdatescheck_action' in 0.516s.
Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in C:\Hosted\ControlPanel\wp-content\plugins\mainwp\class\class-mainwp-uptime-monitoring-connect.php on line 632
Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in C:\Hosted\ControlPanel\wp-content\plugins\mainwp\class\class-mainwp-uptime-monitoring-connect.php on line 632
Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in C:\Hosted\ControlPanel\wp-content\plugins\mainwp\class\class-mainwp-uptime-monitoring-connect.php on line 632
Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in C:\Hosted\ControlPanel\wp-content\plugins\mainwp\class\class-mainwp-uptime-monitoring-connect.php on line 632
Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in C:\Hosted\ControlPanel\wp-content\plugins\mainwp\class\class-mainwp-uptime-monitoring-connect.php on line 632
Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in C:\Hosted\ControlPanel\wp-content\plugins\mainwp\class\class-mainwp-uptime-monitoring-connect.php on line 632
Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in C:\Hosted\ControlPanel\wp-content\plugins\mainwp\class\class-mainwp-uptime-monitoring-connect.php on line 632
Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in C:\Hosted\ControlPanel\wp-content\plugins\mainwp\class\class-mainwp-uptime-monitoring-connect.php on line 632
Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in C:\Hosted\ControlPanel\wp-content\plugins\mainwp\class\class-mainwp-uptime-monitoring-connect.php on line 632
Executed the cron event 'mainwp_cronuptimemonitoringcheck_action' in 6.833s.
Executed the cron event 'mainwp_cron_perform_general_process' in 0.112s.
Executed the cron event 'wordfence_ls_ntp_cron' in 0.016s.
Executed the cron event 'wordfence_hourly_cron' in 0.019s.
Success: Executed a total of 6 cron events.
You may want to look into the uptime-monitoring-connect.php file to remove the deprecated functions eventually once older PHP support is ended.
Thank you for your help. The cron tasks still aren’t running on the site automatically, but that may be because there’s so little traffic. At least now I can run them with the windows task scheduler via the wp-cli.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
WordPress® is a registered trademark of the WordPress Foundation, and WooCommerce® is a registered trademark of WooCommerce, Inc. MainWP is an independent product and is not affiliated, associated, or endorsed by the WordPress Foundation, WooCommerce, Inc., or Automattic Inc., except where noted under the Jetpack® API and Trademark License Agreement. All product names, logos, and brands are property of their respective owners and are used for identification purposes only.