[support] Array as string in forum module

Nick Holden nick at thewebtailor.co.uk
Thu Aug 31 16:22:48 UTC 2006


Hi all,

I don't understand why this is a problem only for me - no sign of it on
the web anywhere...

In the forum module of my 4.7.3 install I have been hitting problems
with the forum when creating or editing containers and forums. Two
errors were common:

[] operator not supported for strings...
and
in_array(): Wrong datatype for second argument in forum.module

Tracing these in the module, they appear to relate to the use of the
$containers variable in the forum_form_submit function:

   if ($container) {
      $containers = variable_get('forum_containers'), array ());
      $containers[] = $form_values['tid'];
      variable_set('forum_containers',$containers)
   }

This appears to be setting the $containers variable to a string datatype
and then trying to treat it as an array. I added [] to the first
definition of $containers and it now works OK.

Have I misunderstood something?

Nick



More information about the support mailing list