Warning: Argument to implode must be an array
VladSavitsky - June 20, 2008 - 16:13
| Project: | Tagadelic |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (code needs review) |
Description
I have found in logs that path tagadelic/chunk/images/x.gif gives a warning:
implode() [function.implode]: Argument to implode must be an array. в файле /home/..../sites/all/modules/tagadelic-6.x-1.0/tagadelic.module в строке 212.
To fix this change:
function tagadelic_get_weighted_tags($vids, $steps = 6, $size = 60) {
//Fixing a bug with wrong path. Start
if (!is_array($vids)) $vids=array();
//Fixing a bug with wrong path. End

#1
My opinion here is just return an array() instead of $vids = array();
Why should we read from the cache wrong data?
<?phpfunction tagadelic_get_weighted_tags($vids, $steps = 6, $size = 60) {
if (!is_array($vids)) {
return array();
}
// ...
?>
#2
Here is my patch.
It against module's HEAD.
#3
Can someone please test this patch?
I like its concept, and like the solution, but need at least one more person to confirm it works and does not break his/her site.
#4
I didn't apply the patch, but made the code change and now receive a "Page Not Found" error, which is acceptable since no tags exist yet.
#5
You should clear the cache IMHO.
#6
if cache is causing this, then we need to implement this in the patch: we should clear the cahce in hook_update, in that case.