in line 145 there is an array merge which is supposed to merge $items_mp4 and $items_others. If I only have one item defined, and that one is mp4, then the array merge call results in an actually empty array. Seems like an odd behaviour of array merge.. but that needs some testing, to fully understand what is happening.
What solved the bug here is to use array_splice to add an array to the end of the other.
array_splice($items_mp4, count($items_mp4), 0, $items_others);
$vars['items'] = $items_mp4;
I also think that some issues posted on the issue queue might be related to this bug, actually.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | single_video_bug-1267932-3.patch | 653 bytes | valderama |
| #1 | single_video_bug-1267932-2.patch | 589 bytes | valderama |
Comments
Comment #1
valderama commentedI could reproduce the bug again on a completely clean install. Basically if you just have one video item, none gets printed because of the unwanted behavior of array_merge.
Attached there is a patch against dev.
Comment #2
aethr commentedI ran into this bug today as well. This is due to the fact that array_merge only accepts arguments of type
array, if$items_othersisNULL(ie it hasnt been defined) then array_merge will fail.This could also be fixed by simply casting both variables as array:
Comment #3
valderama commentedI see, so that is the reason why array_merge fails. I changed the patch accordingly. Now both array get initialized properly. As it is done in the D7 version - so I thought that is the best way.
Hope it will get comitted!
Comment #4
Jorrit commentedWorks for me.
Comment #5
Jorrit commentedFixed in 6.x-1.x.
Comment #6.0
(not verified) commentedupdated