I install Rules Forms Support 7.x-1.0 also I try 7.x-1.x-dev version the same message appears on page /admin/config/workflow/rules How to fix it?

Notice: Undefined index: label in rules_forms_rules_event_info() (line 28 of /var/www/html/ecomap/sites/all/modules/rules_forms/rules_forms.rules.inc).
Notice: Undefined index: label in rules_forms_rules_event_info() (line 32 of /var/www/html/ecomap/sites/all/modules/rules_forms/rules_forms.rules.inc).
Notice: Undefined index: label in rules_forms_rules_event_info() (line 36 of /var/www/html/ecomap/sites/all/modules/rules_forms/rules_forms.rules.inc).
Notice: Undefined index: buttons in rules_forms_rules_event_info() (line 40 of /var/www/html/ecomap/sites/all/modules/rules_forms/rules_forms.rules.inc).

Comments

makbuk created an issue. See original summary.

kris77’s picture

I have the same problem too.
Everything worked well, but then suddenly appeared this mistake.

In admin/config/workflow/rules/forms in ACTIVE FORMS section, there is a blank checkbox.

I think that's the problem but do not know how to remove it.

Thanks.

nixar’s picture

I have the same issue.

Also like Kris77, I have an empty checkbox where there should be my second entityform.

Only the first one is listed correctly.

carrotandme’s picture

The same error message on my website too. It suddenly appeared. Don't know why. So, I cannot reproduce...
If I uninstall Rules Forms Support module and re-install again, the error message disappeared. But, in few days, it appeared again while I developed my website...

socialnicheguru’s picture

$options is an empty array.

markdc’s picture

This also just popped up for me. Had used the module without problems the last months. Was working on some other things and then this popped up. What do we all have in common? A certain config or conflicting module?

spelcheck’s picture

For those of you currently experiencing this issue, please follow these steps to help debug. Note: devel module shouldn't be enabled long-term on production sites.

Install Devel module then navigate to /devel/php and enter this code.

$event_info = variable_get('rules_forms_form_info', array());
dsm($event_info);


Click and expand the "... (Array, # element)" bar, and then please copy and paste the result here. It should end up looking something like this:

... (Array, 1 element)
article_node_form (Array, 7 elements)
label (String, 17 characters ) Article node form
elements (Array, 47 elements)
path (String, 16 characters ) node/add/article
buttons (Boolean) FALSE
validate (Array, 0 elements)
submit (Array, 0 elements)
reset (Boolean) FALSE
spelcheck’s picture

After more research. this is leftover issues from: https://www.drupal.org/node/1447328.

The logic that would prevent this from happening again still needs to be built: https://www.drupal.org/node/1449936. I may try taking that on, but if anybody could still post result of the variable_get above, I'd still be curious to find out *why* it's happening.

markdc’s picture

... (Array, 13 elements)
user_profile_form (Array, 7 elements)
user_register_form (Array, 6 elements)
node_delete_confirm (Array, 6 elements)
file_node_form (Array, 7 elements)
article_node_form (Array, 6 elements)
editableviews_entity_form_user_vacation (Array, 6 elements)
views_exposed_form (Array, 6 elements)
bat_event_edit_form (Array, 6 elements)
editableviews_entity_form_events_heating (Array, 6 elements)
taxonomy_overview_vocabularies (Array, 6 elements)
taxonomy_form_vocabulary (Array, 6 elements)
(Array, 16 elements)
taxonomy_overview_terms (Array, 6 elements)
nixar’s picture

The result I got seems to confirm that this is caused by a malformed array variable:


... (Array, 2 elements)

    request_membership_renewal_entityform_edit_form (Array, 6 elements)
        label (String, 47 characters ) Request membership renewal entityform edit form
        elements (Array, 9 elements)
        path (String, 5 characters ) eform
        buttons (Boolean) TRUE
        validate (Array, 0 elements)
        submit (Array, 2 elements)
    (Array, 5 elements)
        request_membership_renewal_entityform_edit_form (Array, 6 elements)
        (Array, 5 elements)
        elements (Array, 0 elements)
        validate (Array, 0 elements)
        submit (Array, 0 elements)


spelcheck’s picture

nixar, could you expand the unnamed (null) array between request_membership_renewal_entityform_edit_form and elements? fatmarker, it's been a few weeks but if you still have the issue, could you also expand the unnamed array in yours? One of the first elements should be keyed 'label' and will tell us which form was entered incorrectly.

spelcheck’s picture

I have a very minor patch on the way, but meantime this will remove the invalid rules_forms_form_info entries that are stored in the variable table and get things cleaned up before patching. I suggest doing a backup (because why not) and pasting this in /devel/php provided by the devel module to run this. TLDR, this will fix the error messages and the blank check boxes in Rules Form admin. @nixar before you do this, post that expanded null array please.

Note: devel module shouldn't be enabled long-term on production sites.

// get active forms from variable table - rules_forms_form_info
$event_info = variable_get('rules_forms_form_info', array());
$pre_count = count($event_info);

// start by removing the obviously broken entries
unset($event_info[null]);

// remove any entries that are missing a label
foreach ($event_info as $event => $event_data) {
  if (!isset($event_data['label'])) { unset($event_info[$event]); }
}

$post_count = count($event_info);
if ($post_count != $pre_count) {
  dsm($event_info, "Removed " . ($pre_count - $post_count) . " invalid entries.");
  variable_set('rules_forms_form_info', $event_info);
} else { 
  dsm("Nothing to fix.");
}
spelcheck’s picture

StatusFileSize
new732 bytes

This won't fix the error messages if you already have them, but should prevent them. The script I posted above will fix the error messages, and the empty check boxes in Rules Forms admin page.

kris77’s picture

Thanks @elizzle.
I have execute the code in #12 first and then apply the patch in #13.

it seems to work.

Thanks.

nixar’s picture

The original output as posted:

... (Array, 2 elements)

    request_membership_renewal_entityform_edit_form (Array, 6 elements)
        label (String, 47 characters ) Request membership renewal entityform edit form
        elements (Array, 9 elements)
        path (String, 5 characters ) eform
        buttons (Boolean) TRUE
        validate (Array, 0 elements)
        submit (Array, 2 elements)
    (Array, 5 elements)
        request_membership_renewal_entityform_edit_form (Array, 6 elements)
        (Array, 5 elements)
        elements (Array, 0 elements)
        validate (Array, 0 elements)
        submit (Array, 0 elements)

With the expanded array:

... (Array, 2 elements)

    request_membership_renewal_entityform_edit_form (Array, 6 elements)
        label (String, 47 characters ) Request membership renewal entityform edit form
        elements (Array, 9 elements)
        path (String, 5 characters ) eform
        buttons (Boolean) TRUE
        validate (Array, 0 elements)
        submit (Array, 2 elements)
    (Array, 5 elements)
        request_membership_renewal_entityform_edit_form (Array, 6 elements)
        (Array, 5 elements)
            request_membership_renewal_entityform_edit_form (Array, 6 elements)
            (Array, 5 elements)
            elements (Array, 0 elements)
            validate (Array, 0 elements)
            submit (Array, 0 elements)
        elements (Array, 0 elements)
        validate (Array, 0 elements)
        submit (Array, 0 elements)

The new unnamed array also contains the same array/unnamed array/element1/element2/element3...

Thanks for looking into this!

spelcheck’s picture

@nixar very helpful! Good news is that by looking at it, the array structure is exactly what I was hoping to see, and what I was testing against. I'm more confident now that #12 then #13 will work for the long run.

The issue appears to be in rules_forms_after_build, populating $form_info by calling rules_forms_get_form_info with no parameter (or strangely, it being null), but at this point if simply checking for that returned NULL after making that call keeps it from happening again, I'm happy.

nixar’s picture

thanks again for your help with this one @elizzle!

maxplus’s picture

Thanks, testing patch from #13

kris77’s picture

...The error appeared again

spelcheck’s picture

Kris77 can you please run this in /devel/php and paste the results?

// get active forms from variable table - rules_forms_form_info
$event_info = variable_get('rules_forms_form_info', array());
dsm($event_info);
kris77’s picture

This is my output...

... (Array, 9 elements)
serie_a_richiesta_entityform_edit_form (Array, 7 elements)
champions_richiesta_entityform_edit_form (Array, 6 elements)
champions_trasferta_entityform_edit_form (Array, 6 elements)
richiesta_2_serie_a_entityform_edit_form (Array, 6 elements)
coppa_italia_richiesta_entityform_edit_form (Array, 6 elements)
registra_bonifico_attiva_soci_entityform_edit_form (Array, 6 elements)
serie_a_trasferta_entityform_edit_form (Array, 6 elements)
tim_cup_richiesta_entityform_edit_form (Array, 7 elements)
(Array, 12 elements)
serie_a_richiesta_entityform_edit_form (Array, 7 elements)
champions_richiesta_entityform_edit_form (Array, 6 elements)
champions_trasferta_entityform_edit_form (Array, 6 elements)
richiesta_2_serie_a_entityform_edit_form (Array, 6 elements)
coppa_italia_richiesta_entityform_edit_form (Array, 6 elements)
registra_bonifico_attiva_soci_entityform_edit_form (Array, 6 elements)
serie_a_trasferta_entityform_edit_form (Array, 6 elements)
tim_cup_richiesta_entityform_edit_form (Array, 7 elements)
(Array, 12 elements)
elements (Array, 0 elements)
validate (Array, 0 elements)
submit (Array, 0 elements)

Tell me if I have to do more

Thanks @elizzle

danon1981’s picture

When applying the patch #13 I get the following

(Stripping trailing CRs from patch.)
patching file rules_forms.module
patch unexpectedly ends in middle of line
Hunk #1 succeeded at 261 with fuzz 1.

And the error's keep showing.

If useful, this is my dsm output..

... (Array, 9 elements)
email_mail_page_form (Array, 6 elements)
label (String, 20 characters ) Email mail page form
elements (Array, 5 elements)
path (String, 25 characters ) email/node/27/field_email
buttons (Boolean) TRUE
validate (Array, 0 elements)
submit (Array, 1 element)
webform_client_form_312 (Array, 6 elements)
label (String, 22 characters ) Webform cancel account
elements (Array, 8 elements)
path (String, 8 characters ) node/312
buttons (Boolean) TRUE
validate (Array, 0 elements)
submit (Array, 0 elements)
webform_client_form_343 (Array, 6 elements)
label (String, 35 characters ) Webform revoke account cancellation
elements (Array, 2 elements)
path (String, 8 characters ) node/343
buttons (Boolean) TRUE
validate (Array, 0 elements)
submit (Array, 0 elements)
print_mail_form (Array, 6 elements)
label (String, 15 characters ) Print mail form
elements (Array, 8 elements)
path (String, 13 characters ) printmail/297
buttons (Boolean) TRUE
validate (Array, 0 elements)
submit (Array, 0 elements)
mollom_report_form (Array, 6 elements)
label (String, 18 characters ) Mollom report form
elements (Array, 8 elements)
path (String, 47 characters ) mollom/report/mollom_captcha/...
buttons (Boolean) TRUE
validate (Array, 0 elements)
submit (Array, 0 elements)
profile_node_form (Array, 6 elements)
label (String, 17 characters ) Profile node form
elements (Array, 122 elements)
path (String, 13 characters ) node/297/edit
buttons (Boolean) TRUE
validate (Array, 0 elements)
submit (Array, 6 elements)
user_profile_form (Array, 6 elements)
label (String, 17 characters ) User profile form
elements (Array, 128 elements)
path (String, 11 characters ) user/1/edit
buttons (Boolean) TRUE
validate (Array, 0 elements)
submit (Array, 1 element)
webform_client_form_318 (Array, 6 elements)
label (String, 23 characters ) Webform client form 318
elements (Array, 5 elements)
path (String, 8 characters ) node/318
buttons (Boolean) FALSE
validate (Array, 0 elements)
submit (Array, 0 elements)
(Array, 12 elements)

Thanks for looking into this @elizzle

spelcheck’s picture

@danon1981, though it sounds like there is still work to be done on the patch, that patch from #13 should prevent the issue in the future but if you already have the issue, it won't correct it. In order to correct it, use the method in #12.

@Kris77, I'm looking into this, thank you for sending the output.

danon1981’s picture

@elizzle thanks! Sorry, I misunderstood #12

spelcheck’s picture

@Kris77, I've tried all combinations of null, empty, and whitespace named array through the patched version and can't get it to set_variable with an empty array name. At very least we have a system for correcting the issue. Thanks for your help, but for now it's looking like we'll just have to treat the problem as it arises with the one-off script.

kris77’s picture

Ok @elizzle. I understand and thanks so much for your support.

Thanks thanks thanks

markdc’s picture

@elizzle Sorry about my absence. For completeness' sake here's that expanded array:

... (Array, 13 elements)
     user_profile_form (Array, 7 elements)
     user_register_form (Array, 6 elements)
     node_delete_confirm (Array, 6 elements)
     file_node_form (Array, 7 elements)
     article_node_form (Array, 6 elements)
     editableviews_entity_form_user_vacation (Array, 6 elements)
     views_exposed_form (Array, 6 elements)
     bat_event_edit_form (Array, 6 elements)
     editableviews_entity_form_events_heating (Array, 6 elements)
     taxonomy_overview_vocabularies (Array, 6 elements)
     taxonomy_form_vocabulary (Array, 6 elements)
     (Array, 16 elements)
          user_profile_form (Array, 7 elements)
          user_register_form (Array, 6 elements)
          node_delete_confirm (Array, 6 elements)
          file_node_form (Array, 7 elements)
          article_node_form (Array, 6 elements)
          editableviews_entity_form_user_vacation (Array, 6 elements)
          views_exposed_form (Array, 6 elements)
          bat_event_edit_form (Array, 6 elements)
          editableviews_entity_form_events_heating (Array, 6 elements)
          taxonomy_overview_vocabularies (Array, 6 elements)
          taxonomy_form_vocabulary (Array, 6 elements)
          taxonomy_overview_terms (Array, 6 elements)
          elements (Array, 0 elements)
          validate (Array, 0 elements)
          submit (Array, 0 elements)
          reset (Boolean) TRUE
     taxonomy_overview_terms (Array, 6 elements)

I applied your code in #12 and the patch in #13. That unnamed array is gone, the error messages are gone, and I'm not anticipating to ever see that bug again. Well done!!!

socialnicheguru’s picture

I did this:

drush php-eval '// get active forms from variable table - rules_forms_form_info
$event_info = variable_get('rules_forms_form_info', array());
$pre_count = count($event_info);

// start by removing the obviously broken entries
unset($event_info[null]);

// remove any entries that are missing a label
foreach ($event_info as $event => $event_data) {
  if (!isset($event_data['label'])) { unset($event_info[$event]); }
}

$post_count = count($event_info);
if ($post_count != $pre_count) {
  dsm($event_info, "Removed " . ($pre_count - $post_count) . " invalid entries.");
  variable_set('rules_forms_form_info', $event_info);
} else { 
  dsm("Nothing to fix.");
}'

Then apply https://www.drupal.org/files/issues/rules_forms-2851050-1.patch

socialnicheguru’s picture

Status: Active » Needs review
spelcheck’s picture

I don't think 'Needs Review' is the right status, as the patch doesn't prevent the issue from arising, and the script is just a stop-gap. What the issue leads back to is #8:

After more research. this is leftover issues from: https://www.drupal.org/node/1447328.

The logic that would prevent this from happening again still needs to be built: https://www.drupal.org/node/1449936. I may try taking that on, but if anybody could still post result of the variable_get above, I'd still be curious to find out *why* it's happening.

More logic needs to be built into rules_forms_after_build() to validate and prevent the empty array key from being saved to variables in the first place.

HunterElliott’s picture

I'm also getting the error, but when I execute the PHP code the Arrays show 0 elements

... (Array, 1 element)

    (Array, 3 elements)
        elements (Array, 0 elements)
        validate (Array, 0 elements)
        submit (Array, 0 elements)
 Called from /var/www/html/{sitefolder}/includes/form.inc, line 1520   
raoofabdul’s picture

rules_forms_rules.inc @ line # 28, 32, and 36
variable $info['label'] is null thats why

how about if condition at line # 27 ?

if(isset($info['label']) && $info['label'] != NULL){
shivenduray’s picture

Status: Needs review » Patch (to be ported)
Issue tags: +rules forms support
StatusFileSize
new4.09 KB

Hello Everyone,

I did this change in code and working fine with me. i creating patch file you can also apply this patch.

-Put patch files on root path
-Module location should be under sites/all/modules/

Thank's

kris77’s picture

Hi @shivenduray,
I ran the code in #12 first to delete the blank form, then I applied your patch and it seems to work.

Thanks @shivenduray.

Patch #33 work for me with Drupal 7.56 and Rules_Form_Support 7.x-1.0

markdc’s picture

After running #12 script and applying #13 patch some months ago, the issue just recently returned. And as the first time, I couldn't pinpoint what triggered it — it seemingly came out of nowhere. I wasn't working with Rules or Forms Support.

I've again run #12 to remove the defective array, and this time patched with #33. So far, so good. But due to the nature of this issue, only time will tell if it's a working fix. If you don't hear from me again then it's still working.

caminadaf’s picture

Patch #33 contains 4 spaces indentation instead of 2 spaces, but the content seems valid. Since @fatmarker didn't come back I'm assuming that he didn't have any more problems with this.

caminadaf’s picture

Status: Patch (to be ported) » Fixed

Commited #33 with #13 and a few tweaks

  • caminadaf committed 5434493 on 7.x-1.x
    Issue #2851050 by elizzle, shivenduray, Kris77, nixar, fatmarker,...

Status: Fixed » Closed (fixed)

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