Hi

I needed to add a few fields to the default ones on the theme_signup_user_form() function, from which two are of the type 'textarea'.
So no, my theme_signup_user_form() looks a bit like this:

function theme_signup_user_form() {
global $user;

// This line is required for this form to function -- DO NOT EDIT OR REMOVE.
$form['signup_form_data']['#tree'] = TRUE;

$form['signup_form_data']['Name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#size' => 40, '#maxlength' => 64,
'#required' => true,
);

$form['signup_form_data']['Nationality'] = array(
'#type' => 'textfield',
'#title' => t('Nationality'),
'#size' => 40, '#maxlength' => 64,
);
$form['signup_form_data']['Address'] = array(
'#type' => 'textarea',
'#title' => t('Address'),
'#cols' => 40, '#rows' => 4,
);
$form['signup_form_data']['Email'] = array(
'#type' => 'textfield',
'#title' => t('Email'),
'#size' => 40, '#maxlength' => 64,
'#required' => true,
);

$form['signup_form_data']['Other'] = array(
'#type' => 'textarea',
'#title' => t('Other required entries - check event description'),
'#cols' => 40, '#rows' => 6,
);

// If the user is logged in, fill in their name by default.
if ($user->uid) {
$form['signup_form_data']['Name']['#default_value'] = $user->name;
}
return $form;
}

The problem is that every time someones registers for an event, I get an error:
"mb_strlen() expects parameter 1 to be string, array given in includes/unicode.inc on line 370."

I have to confess that I'm not an expert, and this is probably not a bug in the signup module per se, but I would like to know if I can correct this (and how) or if this is indeed a bug in the signup module.

Oh, and I only used the type 'textarea' because it's the only one that I'm aware of that has multiple line input.

Best regards

Comments

dww’s picture

Category: bug » support
Status: Active » Closed (works as designed)

Hrm, I just tried adding a textarea to the signup form on my test site and had no problems. I can't reproduce this, so I'm guessing it must have been something weird with this particular user's site. *shrug*

mdshields’s picture

Version: 5.x-2.4 » 7.x-1.x-dev

I am receiving this exact same error in Drupal 7.

The second "Textarea" using the Form API has conflicts with the unicode include file.

I think the real issue is that the unicode include file needs a lot of work. After searching through Drupal, I found hundreds of issues of the exact same error message on the exact same line of code:

Warning: mb_strlen() expects parameter 1 to be string, array given in drupal_strlen() (line 442 of C:\Program Files (x86)\Apache2\htdocs\proj\includes\unicode.inc).

This makes sense, because I can assure you that 95% of the technical community does not properly understand unicode. So, of course, this will be an ongoing bug. What usually occurs in software that tries to integrate with unicode is that there are spurious errors of a multitude of problems and developers try hard to fix every one of those problems. However, the real key to solving unicode issues is implementing it correctly, then you don't have to fix any of the side effects.