Problem/Motivation
\Drupal\auditfiles\Batch\AuditFilesMergeFileReferencesBatchProcess::auditfilesMergeFileReferencesBatchMergeProcessBatch type hints $files_being_merged as an array.
Similarly \Drupal\auditfiles\Batch\AuditFilesMergeFileReferencesBatchProcess::$fileIds is type-hinted as an array.
However
\Drupal\auditfiles\ServiceAuditFilesMergeFileReferences::auditfilesMergeFileReferencesBatchMergeCreateBatch sets up the batch task using each separate file ID - these are integers and hence this causes a fatal error because an int isn't an array.
Similarly in \Drupal\auditfiles\Batch\AuditFilesMergeFileReferencesBatchProcess::dispatch it calls to \Drupal\auditfiles\ServiceAuditFilesMergeFileReferences::auditfilesMergeFileReferencesBatchMergeProcessFile using \Drupal\auditfiles\Batch\AuditFilesMergeFileReferencesBatchProcess::$fileIds
Which is the reverse, passing an array instead of an integer
Steps to reproduce
Try to use the merge file reference function
Proposed resolution
Remove the array typehints from \Drupal\auditfiles\Batch\AuditFilesMergeFileReferencesBatchProcess::$fileIds and \Drupal\auditfiles\Batch\AuditFilesMergeFileReferencesBatchProcess::auditfilesMergeFileReferencesBatchMergeProcessBatch
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3210844.patch | 3.19 KB | larowlan |
Issue fork auditfiles-3210844
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
larowlanComment #3
acbramley commentedFeels like we're missing test coverage here?
Comment #4
kim.pepperComment #5
anybodyJust ran into the same issue and reviewed and tested #2 for that reason. #2 fixed the issue for me.
So as it's a clear code fix, I'll set this RTBC, but if additional test coverage is needed, feel free to reset to NW.
Comment #7
dpiComment #9
dpiManually tested this, seems to work well.
Added a few extra improvements in the update to D9 in 4.x
Comment #11
dpi