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_copy() say, 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 copied, because the destination %destination is invalid. This is often caused by improper use of file_copy() 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 copied, because the destination is invalid. More information is available in the system log.', array('%file' => $source->uri)), 'error');
return FALSE;
Comments
Comment #1
pillarsdotnet commentedThe following patch corrects the code to match the docs.
Comment #3
pillarsdotnet commented#1: file_copy-make_code_match_docs-1192446-1.patch queued for re-testing.
Comment #4
pillarsdotnet commentedComment #5
pillarsdotnet commentedComment #6
pillarsdotnet commentedDuplicate of #1192440: Make docs of file_copy() match code.