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.

CommentFileSizeAuthor
#1 incorrect_var-159474-1.patch643 byteschx
file_16.patch639 bytespaddy_deburca

Comments

chx’s picture

Priority: Normal » Minor
Status: Active » Reviewed & tested by the community
StatusFileSize
new643 bytes
gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)