- Patch #504422 by catch, drewish: file_load_multiple() missing a sanity check.
parent
12893d0bd3
commit
9b4013fd82
|
@ -494,6 +494,11 @@ function file_check_location($source, $directory = '') {
|
|||
* @see file_load()
|
||||
*/
|
||||
function file_load_multiple($fids = array(), $conditions = array()) {
|
||||
// If they don't provide any criteria return nothing rather than all files.
|
||||
if (!$fids && !$conditions) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$query = db_select('files', 'f')->fields('f');
|
||||
|
||||
// If the $fids array is populated, add those to the query.
|
||||
|
|
|
@ -598,6 +598,9 @@ class FileSaveUploadTest extends FileHookTestCase {
|
|||
$files = file_load_multiple(array($file1->fid, $file2->fid));
|
||||
$this->assertTrue(isset($files[$file1->fid]), t('File was loaded successfully'));
|
||||
$this->assertTrue(isset($files[$file2->fid]), t('File was loaded successfully'));
|
||||
|
||||
// Check that file_load_multiple() with no arguments returns FALSE.
|
||||
$this->assertFalse(file_load_multiple(), t('No files were loaded.'));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue