After I updated the php on my Drupal site to 5.4 all these warnings popped up.
Here is the strict warning messages:

  • strict warning: Declaration of backup_migrate_filter_backup_restore::backup_settings_form_submit() should be compatible with backup_migrate_filter::backup_settings_form_submit($form, &$form_state) in /var/www/html/test_site/sites/all/modules/backup_migrate/includes/filters.backup_restore.inc on line 169.
  • strict warning: Declaration of backup_migrate_filter_backup_restore::backup() should be compatible with backup_migrate_filter::backup($file, $settings) in /var/www/html/test_site/sites/all/modules/backup_migrate/includes/filters.backup_restore.inc on line 169.
  • strict warning: Declaration of backup_migrate_filter_backup_restore::restore() should be compatible with backup_migrate_filter::restore($file, $settings) in /var/www/html/test_site/sites/all/modules/backup_migrate/includes/filters.backup_restore.inc on line 169.
  • strict warning: Declaration of backup_migrate_filter_compression::restore() should be compatible with backup_migrate_filter::restore($file, $settings) in /var/www/html/test_site/sites/all/modules/backup_migrate/includes/filters.compression.inc on line 288.
  • strict warning: Declaration of backup_migrate_filter_encryption::restore() should be compatible with backup_migrate_filter::restore($file, $settings) in /var/www/html/test_site/sites/all/modules/backup_migrate/includes/filters.encryption.inc on line 176.
  • strict warning: Non-static method backup_migrate_destination::create() should not be called statically in /var/www/html/test_site/sites/all/modules/backup_migrate/includes/destinations.inc on line 193.
  • strict warning: Non-static method backup_migrate_destination::create() should not be called statically in /var/www/html/test_site/sites/all/modules/backup_migrate/includes/destinations.inc on line 193.
  • strict warning: Non-static method backup_migrate_destination::create() should not be called statically in /var/www/html/test_site/sites/all/modules/backup_migrate/includes/destinations.inc on line 193.
  • strict warning: Non-static method backup_migrate_destination::create() should not be called statically in /var/www/html/test_site/sites/all/modules/backup_migrate/includes/destinations.inc on line 193.
  • strict warning: Declaration of backup_migrate_destination_db_mysql::_unlock_tables() should be compatible with backup_migrate_destination_db::_unlock_tables($tables) in /var/www/html/test_site/sites/all/modules/backup_migrate/includes/destinations.db.mysql.inc on line 288.
  • strict warning: Non-static method backup_migrate_destination::create() should not be called statically in /var/www/html/test_site/sites/all/modules/backup_migrate/includes/destinations.inc on line 193.

Comments

dougthelegoman’s picture

Version: 6.x-2.5 » 6.x-2.6

I just got the same set of warnings.
I am using php 5.4.3.
I just installed Backup and Migrate.
I've seen a similar problem with the Filefield module (http://drupal.org/node/1728248).

steeph’s picture

From reading similar issues on othe rmodules I don't expect this to be fixed in D6. I'm using PHP 5.3 on my D6 sites.

dougthelegoman’s picture

Is there a secret to switching back and forth between php versions? Every time that I try, my apache is too new, so I change apache, change php, and then my site crashes and nothing works until I switch everything back.
Thanks

steeph’s picture

I have no problem for Drupal switching PHP versions back and forth. If you can't find what's going wrong you should open a new thread in the forum or support mailing list and provide more info on what's happening.

dougthelegoman’s picture

Thanks, I'm just going to upgrade to d7.

curiosity26’s picture

Assigned: Unassigned » curiosity26
Status: Active » Needs review
Issue tags: +PHP 5.4
StatusFileSize
new93.04 KB

I ran into this issue too. Unfortunately, I can't just up and migrate all my sites to Drupal 7, so I thought I would just issue this fix. It's actually very simple. PHP 5.4 gets a huge performance boost by enforcing that the programmer handles their own argument definitions and class extension conformity. If the function defined in a base class has a parameter passed by reference, all functions thereafter must also pass that parameter by reference, and vice versa. Also, if a function takes x parameters, giving it x + n parameters in an extended definition will result in an error. Instead, use func_get_args and pull the arguments off the end. If you want to pass these extended args by reference, pass in the data wrapped in a stdClass. As of PHP 5, objects are always passed by ref.

Anyway, I've isolated the files that have the issue. I use MySQL so if you use pg or ms, you might still get an error in the db connector include. I just zipped the whole module because it's much easier.

curiosity26’s picture

StatusFileSize
new92.98 KB

Sorry, guys. Use this version. I missed the issue with statically calling backup_migrate_destination::create. This is fixed in this version.

gregober’s picture

Do you know if this can be merged into the 6 branch of Backup and Migrate ?
I would need this patch, but I prefer to stick to "official branches" ?

Thanks for your reply.

curiosity26’s picture

The file I posted was for D6, btw. I haven't submitted an official patch yet. I'm still fumbling with tracing a few hanging issues. The fix above silences the errors from the original post, as well as many other errors. But there's still an issue with cron and scheduled backups. The array of schedules seems to fall out. There's also an issue with certain admin forms showing up. I think the two issues might be somewhat related. As soon as I get an initial working version, I plan on submitting to the official channels for proper review.

drupa11y’s picture

Works good. Thanks!

curiosity26’s picture

Status: Needs review » Patch (to be ported)
StatusFileSize
new162.16 KB

Still a few things with the newest version that doesn't comply in php 5.4. Invalid static function call on backup_migrate_destination::create() is the initial culprit. The rest is inconsistent class function extensions with pass by reference parameters. This patch fixes them. Tested. Hope this cures what ails ya!

PS. I use mysql so I only made updates to destinations.db.inc in the includes directory. There might be some errors popup if you use S3 or some other db. Easy fix though.

crutch’s picture

After applying #11 I get

Fatal error: Cannot redeclare backup_migrate_destination_files::get_file() in

Should I apply #7 first then #11?

nicolas bouteille’s picture

In includes/destinations.inc changing the function create to a static function will cause problems. Instead what I tried was to change the call from a static one to a non static one by creating an instance of the class backup_migrate_destination;

on line 192, this code :

<?php
function backup_migrate_create_destination($destination_type, $params = array()) {
  $params['type'] = $destination_type;
  return backup_migrate_destination::create($params);
}
?>

should be changed to this :

<?php
function backup_migrate_create_destination($destination_type, $params = array()) {
  $params['type'] = $destination_type;
  $destination = new backup_migrate_destination;
  return $destination->create($params);
}
?>

It seems to be working for me. Warnings are gone and I am still able to do backups whereas I couldn't if declared static.

ronan’s picture

Version: 6.x-2.6 » 6.x-2.x-dev
Status: Patch (to be ported) » Fixed

I was unable to reproduce the errors, but I backported the backup_migrate_create_destination function from the d7 version so hopefully this is fixed for everybody now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sonictruth’s picture

Status: Closed (fixed) » Active

I'm still getting this error with 6.x-2.7. PHP 5.4.10

Declaration of backup_migrate_filter_backup_restore::backup_settings_form_submit() should be compatible with backup_migrate_filter::backup_settings_form_submit($form, &$form_state) in /sites/all/modules/backup_migrate/includes/filters.backup_restore.inc on line 0. 
sonictruth’s picture

StatusFileSize
new3.15 KB

Here's a patch. Basically just a few ampersands in function definitions needed but it made the errors go away for me.

ronan’s picture

Status: Active » Fixed

Looks good. Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jvieille’s picture

I am still getting this error:

Warning: Missing argument 1 for backup_migrate_destination_db_mysql::_unlock_tables(), called in .../sites/all/modules/backup_migrate/includes/destinations.db.inc on line 289 and defined in backup_migrate_destination_db_mysql->_unlock_tables() (line 189 of .../sites/all/modules/backup_migrate/includes/destinations.db.mysql.inc)

The offending code is the following:

  /**
   * Unlock any tables that have been locked.
   */
  function unlock_tables($settings) {
    if ($settings->filters['utils_lock_tables']) {
      $this->_unlock_tables();
    }
  }

It seems only normal that php complains about $this->_unlock_tables();
What is the purpose of this argument if it is never used?

This code is still in D7.
D8 also requires a useless argment, but does not call the function explicitly.

  /**
   * Unlock all tables in the database.
   */
  protected function _unlockTables($settings) {
    $this->query('UNLOCK TABLES');
  }

ivnish’s picture

Assigned: curiosity26 » Unassigned