Hello,

On my registration form I have first name middle initial last name and suffix.. I am assigning usernames using first initial last name and first and last name are only required fields.. I am noticing this error quite frequently. I looked at the file and it appears to have something to do with middle initial.

line 142 >> if (!empty($form_state['values'][$c->mname])) {

// A middle name may not contain symbols or numbers.
if (!$c->mname->use_content_profile) {
if (!empty($form_state['values'][$c->mname])) {
if (preg_match("/[\!\#\$\%\^\*\(\)\[\]\{\}\\\|\/\?\.\>\<\\\"\+,:;=&@0-9]/", $form_state['values'][$c->mname])) {
form_set_error($c->mname, t('Middle name may not contain symbols or numbers.'));
}

php:
Illegal offset type in isset or empty in home/public_html/sites/all/modules/realname_registration/realname_registration.module on line 142

traceback:
Type: php
Illegal offset type in isset or empty in /home/public_html/sites/all/modules/realname_registration/realname_registration.module on line 142.
Backtrace:
realname_registration_validate(array)[form.inc:786];
.form_execute_handlers(array)[form.inc:731];
.._form_validate(array)[form.inc:596];
...drupal_validate_form(array)[form.inc:415];
....drupal_process_form(array)[form.inc:120];
.....drupal_get_form(a:1:{i:0;s:13:"user_register";})[autoassignrole-path.inc:17];
......autoassignrole_path(a:1:{i:0;s:3:"108";})[?:?];
.......call_user_func_array(a:2:{i:0;s:19:"autoassignrole_path";i:1;a:1:{i:0;s:3:"108";}})[menu.inc:350];
........menu_execute_active_handler(a:0:{})[index.php:17];
.........index.php

Any ideas why I am getting this error?

Sincerely,
Paul

Comments

sgerbino’s picture

At first glance it would seem I try to validate the field in an inproper way, I think perhaps changing it like this:

// Old way
 if (!empty($form_state['values'][$c->mname])) {

// New way
 if (!empty($c->mname) && !empty($form_state['values'][$c->mname])) {

I will fix it, I'll take a closer. If you try it let me know if it worked for you.

modiphier’s picture

Hi,

Thanks. I commented out the original line and added it. I will watch my recent log entries and let you know if the error goes away.

modiphier’s picture

nope.. looks like its still creating an error:
Type: php
Illegal offset type in isset or empty in /home/public_html/sites/all/modules/realname_registration/realname_registration.module on line 148.
Backtrace:
realname_registration_validate(array)[form.inc:786];
.form_execute_handlers(array)[form.inc:731];
.._form_validate(array)[form.inc:596];
...drupal_validate_form(array)[form.inc:415];
....drupal_process_form(array)[form.inc:120];
.....drupal_get_form(a:1:{i:0;s:13:"user_register";})[autoassignrole-path.inc:17];
......autoassignrole_path(a:1:{i:0;s:3:"108";})[?:?];
.......call_user_func_array(a:2:{i:0;s:19:"autoassignrole_path";i:1;a:1:{i:0;s:3:"108";}})[menu.inc:350];
........menu_execute_active_handler(a:0:{})[index.php:17];
.........index.php

mvc’s picture

Status: Active » Fixed

I reproduced this; fixed in 6.x-2.x-dev.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.