Download & Extend

file_destination incorrectly uses var $source rather than $destination

Project:Drupal core
Version:6.x-dev
Component:file system
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The code for file_destination() is

function file_destination($destination, $replace) {
  if (file_exists($destination)) {
    switch ($replace) {
      case FILE_EXISTS_RENAME:
        $basename = basename($destination);
        $directory = dirname($destination);
        $destination = file_create_filename($basename, $directory);
        break;

      case FILE_EXISTS_ERROR:
        drupal_set_message(t('The selected file %file could not be copied, because a file by that name already exists in the destination.', array('%file' => $source)), 'error');
        return FALSE;
    }
  }
  return $destination;
}

however, $source is not previously declared, $destination should be used.

AttachmentSizeStatusTest resultOperations
file_16.patch639 bytesIgnored: Check issue status.NoneNone

Comments

#1

Priority:normal» minor
Status:active» reviewed & tested by the community
AttachmentSizeStatusTest resultOperations
incorrect_var-159474-1.patch643 bytesIgnored: Check issue status.NoneNone

#2

Status:reviewed & tested by the community» fixed

Thanks, committed.

#3

Status:fixed» closed (fixed)