Skip to content

crash on cronjob detection #641

Description

@Korrlub

Describe the bug

Automated backups, remote backup to Amazon S3 and Google Drive, stop website crashes before they happen and more. Total Upkeep is the backup solution you need.
Version 1.17.4 | Von [BoldGrid](https://www.boldgrid.com/) | [Details anzeigen](https://xxx/wp-admin/plugin-install.php?tab=plugin-information&plugin=boldgrid-backup&TB_iframe=true&width=772&height=769)
Dieses Plugin konnte nicht ordnungsgemäß geladen werden und ist im Wiederherstellungsmodus pausiert.
Ein Fehler vom Typ E_ERROR wurde in der Zeile 651 der Datei /var/www/vhosts/xxx/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-cron.php verursacht.
Fehlermeldung: 
Uncaught TypeError: array_search(): Argument #2 ($haystack) must be of type array, false given in /var/www/vhosts/xxx/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-cron.php:651 Stack trace: #0 /var/www/vhosts/xxx/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-cron.php(651): array_search('# Total Upkeep ...', false, true) #1 /var/www/vhosts/xxx/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-test.php(434): Boldgrid_Backup_Admin_Cron->entry_delete('# Total Upkeep ...') #2 /var/www/vhosts/xxx/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-scheduler.php(102): Boldgrid_Backup_Admin_Test->is_crontab_available() #3 /var/www/vhosts/xxx/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-scheduler.php(69): Boldgrid_Backup_Admin_Scheduler->get_available() #4 /var/www/vhosts/xxx/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-cron.php(1573): Boldgrid_Backup_Admin_Scheduler->get() #5 /var/www/vhosts/xxx/wp-includes/class-wp-hook.php(341): Boldgrid_Backup_Admin_Cron->upgrade_crontab_entries('') #6 /var/www/vhosts/xxx/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array) #7 /var/www/vhosts/xxx/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #8 /var/www/vhosts/xxx/wp-admin/admin.php(180): do_action('admin_init') #9 /var/www/vhosts/xxx/wp-admin/index.php(10): require_once('/var/www/vhosts...') #10 {main} thrown

To Reproduce
Should specific to some providers that somehow allow cronjobs but may not be allowed to manage them via php script?
probably related to #457

Expected behavior
proper detection that cron not available for this plugin.

Additional context
to avoid the script crash it's possible to modify
public function entry_delete( $entry ) in class-boldgrid-backup-admin-cron.php

current:

$all_entries = $this->get_all();

$key = array_search( $entry, $all_entries, true );

quick fix:

$all_entries = $this->get_all();

if ( ! is_array( $all_entries ) ) {
	return false;
}

$key = array_search( $entry, $all_entries, true );

this doesn't fix the issue itself wrong detection of cron availability for wp or this plugin. But allow to use the plugin on systems with php>8

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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