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

vladimir.dolgopolov - August 12, 2008 - 17:28

My opinion here is just return an array() instead of $vids = array();
Why should we read from the cache wrong data?

<?php
function tagadelic_get_weighted_tags($vids, $steps = 6, $size = 60) {
  if (!
is_array($vids)) {
    return array();
  }
 
// ...
?>

#2

vladimir.dolgopolov - August 13, 2008 - 07:31

Here is my patch.
It against module's HEAD.

AttachmentSize
tagadelic_272966.patch748 bytes

#3

Bèr Kessels - August 14, 2008 - 18:53

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

brainlock - August 25, 2008 - 18:25

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

vladimir.dolgopolov - August 26, 2008 - 02:48

You should clear the cache IMHO.

#6

Bèr Kessels - August 28, 2008 - 13:46

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.

 
 

Drupal is a registered trademark of Dries Buytaert.