Fatal error when trying to view Saved Backups that include FTP destination

Created on 6 December 2016, over 7 years ago
Updated 28 December 2023, 6 months ago

I've already tested this on three separate sites.

After adding an ftp destination, if the backup completes successfully, trying to visit the tab Saved Backups produces the following fatal error:

Fatal error: Call to a member function filepath() on a non-object in ../sites/all/modules/backup_migrate/includes/destinations.inc on line 886

After visiting the home page, another warning and an error appear:

Warning: fclose() expects parameter 1 to be resource, boolean given in drupal_ftp_ftp_to_file() (line 223 of .../public_html/sites/all/modules/backup_migrate/includes/destinations.ftp.inc).
FTP Error: Unable to download file: ./...mysql.zip.info from .

Deleting the .info file from the ftp server displays the Saved backup normally on the "Saved Backups" tab

Line 886 of the destinations.inc file is:

$info = drupal_parse_info_file($info_file->filepath());

Lines 220 to 223 of the destinations.ftp.inc file are:

  // We have changed into the directory, let's attempt to get the file
  $fp = @fopen($file, 'wb');
  $get_file = @ftp_fget($ftp->__conn, $fp, $filename, FTP_BINARY);
  fclose($fp);

I believe that @fopen returns FALSE and hence the error. I don't know what $file is supposed to be, but changing line 221 from

$fp = @fopen($file, 'wb');

to

$fp = @fopen($filename, 'wb');

seemed to be the trick. As this was done with very crude tests, I wouldn't suggest this as a solution.

πŸ› Bug report
Status

Closed: outdated

Version

3.0

Component

Code

Created by

πŸ‡¬πŸ‡·Greece gluer

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡±Netherlands BrankoC

    I can confirm that this bug is still present in Backup and Migrate 7.x-3.10.

    I ran across it while trying to fix bugs caused by changes in PHP as of PHP 8.

    Since over the years so few people appear to have encountered this bug, there may be special conditions required to trigger it. My guess is it may have to do with me developing under MS Windows (10 Home) and running a FTP-server on that platform to test against.

    I won't reopen because I am not sure fixing it won't do more damage than leaving it alone.

Production build 0.69.0 2024