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() 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 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;
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | file_move-make_docs_match_code-1192456-8.patch | 1.04 KB | pillarsdotnet |
| #1 | file_move-make_docs_match_code-1192456-1.patch | 1.13 KB | pillarsdotnet |
Comments
Comment #1
pillarsdotnet commentedPatch makes docs match code.
Comment #3
pillarsdotnet commented#1: file_move-make_docs_match_code-1192456-1.patch queued for re-testing.
Comment #5
pillarsdotnet commented#1: file_move-make_docs_match_code-1192456-1.patch queued for re-testing.
Comment #6
pillarsdotnet commentedComment #7
jhodgdonI don't think it's necessary to say what happens if the value is omitted. Just say it's required, or better yet just don't say anything, because we all know that PHP function arguments are generally required unless they are stated to be optional. We don't want to set a precedent of documenting what happens if people leave out required args in every function in Drupal.
Comment #8
pillarsdotnet commentedCorrected as suggested. See also alternative #1192458: Make code for file_move() match docs.
Comment #9
jhodgdonLooks fine.
Comment #10
webchickCommitted to 8.x and 7.x. Thanks!