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:needs work
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.patch 748 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.

#7

Bèr Kessels - November 11, 2008 - 13:39
Status:needs review» needs work

patch should implement a cache wipe in the update, else people get warnings.

#8

rkdesantos - April 17, 2009 - 17:11

I am seeing a similar error in v5:

Message implode() [<a href='function.implode'>function.implode</a>]: Argument must be an array in /home/..../modules/tagadelic/tagadelic.module on line 208.

#9

rkdesantos - July 4, 2009 - 14:13

I'm interested in getting a fix against D5 but has this ever been fixed against either D6 or D5?

#10

Bèr Kessels - September 6, 2009 - 14:50

IMO we should travers up the calling functions and fix it in the first place: simply make sure we never call the function tagadelic_get_weighted_tags without an array if vids!

 
 

Drupal is a registered trademark of Dries Buytaert.