Breaking this off from #1191236: Correct file_copy, file_move, file_save_data, and drupal_realpath to match documentation and their unmanaged counterparts.

The documentation for the $destination parameter to file_move() says, in part:

If this value is omitted, Drupal's default files scheme will be used, usually "public://".

However, this claim is untrue. Omitting the $destination parameter will actually result in the following code being executed:

     watchdog('file', 'File %file (%realpath) could not be moved, because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->uri, '%realpath' => drupal_realpath($source->uri), '%destination' => $destination));
    drupal_set_message(t('The specified file %file could not be moved, because the destination is invalid. More information is available in the system log.', array('%file' => $source->uri)), 'error');
    return FALSE;

Comments

pillarsdotnet’s picture

Status: Active » Needs review
StatusFileSize
new1.38 KB

Patch fixes code to match docs.

Status: Needs review » Needs work

The last submitted patch, file_move-make_code_match_docs-1192458-1.patch, failed testing.

pillarsdotnet’s picture

Status: Needs work » Needs review
pillarsdotnet’s picture

Title: Make code for file_move() match docs » Make code for file_move() match docs.
Issue tags: +Needs backport to D7
pillarsdotnet’s picture

Issue tags: +API clean-up
pillarsdotnet’s picture

Status: Needs review » Closed (duplicate)