[support] Array as string in forum module

Greg SBC gregbjh at sbcglobal.net
Thu Aug 31 16:49:12 UTC 2006


Which version of php are you using? Maybe php5 is more strict in its
intrepretations.

Greg 

-----Original Message-----
From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On
Behalf Of Nick Holden
Sent: Thursday, August 31, 2006 9:23 AM
To: support at drupal.org
Subject: [support] Array as string in forum module

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

-- 
[ Drupal support list | http://lists.drupal.org/ ]



More information about the support mailing list