Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443488
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3443488
Commits
9b4013fd
Commit
9b4013fd
authored
15 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#504422
by catch, drewish: file_load_multiple() missing a sanity check.
parent
12893d0b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
includes/file.inc
+5
-0
5 additions, 0 deletions
includes/file.inc
modules/simpletest/tests/file.test
+3
-0
3 additions, 0 deletions
modules/simpletest/tests/file.test
with
8 additions
and
0 deletions
includes/file.inc
+
5
−
0
View file @
9b4013fd
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
modules/simpletest/tests/file.test
+
3
−
0
View file @
9b4013fd
...
...
@@ -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.'
));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment