How to fix error with Magento Backup Tool in version 1.3.2.x

A lot of our clients have reported a problem with the built-in database Backup Tool in Magento version 1.3.2.x, caused by a bug in a Magento core file. The problem is identified by the following error message:

Warning: Invalid argument supplied for foreach() in /home/USERNAME/public_html/MAGENTO_DIRECTORY/lib/Varien/Data/Collection/Filesystem.php on line 234

The good news is that there is a easy fix to the problem. If you are confident editing files in your account, you can follow these steps:

  1. Open the file: /home/USERNAME/public_html/MAGENTO_DIRECTORY/lib/Varien/Data/Collection/Filesystem.php. Replace USERNAME and MAGENTO_DIRECTORY with your account username and Magento root directory, respectively.
  2. Go to line 234, and replace the following line:
    foreach (glob($folder . DIRECTORY_SEPARATOR . '*') as $node) {
  3. With this:
    foreach ((array)glob($folder . DIRECTORY_SEPARATOR . '*') as $node) {
  4. Save the file, and you should be all set.

Feel free to open a support ticket if you have any questions or need help applying the fix.

Was this answer helpful?