actions.inc will sometimes try to access a nonexistent array key, causing a notice:

WD php: Notice: Undefined index: configurable in actions_synchronize() (line 323 of includes/actions.inc).
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joshuajabbour’s picture

Status: Active » Needs review
FileSize
622 bytes

d7 patch

joshuajabbour’s picture

FileSize
658 bytes

d6 backport

mikeytown2’s picture

#2 works for 6.x.

mikeytown2’s picture

Updated #2 patch for git

Status: Needs review » Needs work

The last submitted patch, drupal-actions-985814-4-D6.patch, failed testing.

mikeytown2’s picture

Status: Needs work » Needs review
FileSize
630 bytes

Redo #1 for test bot.

rogical’s picture

issue still existed after applying patch (occur on enabling a rules featrue):

Notice: Undefined index: type in actions_synchronize() (line 292 of /opt/development/yourhelps/includes/actions.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'type' cannot be null: INSERT INTO {actions} (aid, type, callback, parameters, label) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => help_c2c_action_delete [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => help_c2c_action_delete [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => Delete help c2c entities when referenced node was deleted ) in actions_synchronize() (line 297 of /opt/development/yourhelps/includes/actions.inc).
mikeytown2’s picture

@rogical
That is most likely an issue with some code that implements hook_action_info(). In any case I've modified the patch so accommodate your issue as well.

rogical’s picture

This time it works, thanks!

filijonka’s picture

Status: Needs review » Needs work

This patch won't solve the first error message cause empty doesn't check if the index exists. And that is what the error message says.

mikeytown2’s picture

Status: Needs work » Needs review
FileSize
879 bytes

check to make sure an array was passed in.

filijonka’s picture

Status: Needs review » Postponed (maintainer needs more info)

could we please try to find out why this errormessage exists? Just because it says undefined index doesn't mean that we should check that this index is set (which no patch is doing). We should ask why the index isn't set.

So we need information how to reproduce this error.

rogical’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community

I encountered this error during enable user points module, it was solved with patch at #11, thanks!

Notice: Undefined index: type in actions_synchronize() (line 292 of /opt/development/yourhelps/includes/actions.inc).

Notice: Undefined index: configurable in actions_synchronize() (line 282 of /opt/development/yourhelps/includes/actions.inc).

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'type' cannot be null: INSERT INTO {actions} (aid, type, callback, parameters, label) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => help_c2c_action_delete [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => help_c2c_action_delete [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => Delete help c2c entities when referenced node was deleted ) in actions_synchronize() (line 297 of /opt/development/yourhelps/includes/actions.inc).

filijonka’s picture

Status: Reviewed & tested by the community » Needs review

hi

this isn't tested by the community; there's no test here.

I'm setting this to needs review so perhaps someone else can take a look at the patch.

My opinion mentioned in #12 stands; the patch isn't solving the error and we need steps to reproduce this error.

aaronschachter’s picture

i was getting this error once i added my own hook_action_info() in a custom module. found this thread and then this one: http://drupal.org/node/1566090.

i didn't define 'configurable' in my hook_action_info() - once i did, the error stopped.

filijonka’s picture

Status: Needs review » Closed (works as designed)

thanks @aaron.

I think we safely can say that this isn't because of an error in core but when contributed modules isn't doing the right things..

SocialNicheGuru’s picture

This might be related to the following issue:

http://drupal.org/node/883944#comment-5986304

in essence a module is not defining all items needed for actions.module

Dave Reid’s picture

Yes, this problem definitely means a contrib module is not implementing the hook correctly.

DrupalDan’s picture

I got the same problem after installing and enabling one module, but I don't know how to fix this. Can anyone share some solutions?

@Dave Reid, if this problem means a module is not implementing the hook correctly, what do you think the cause could be, I mean, the cause of "not implementing the hook correctly". Do you think it could be a db problem?

Thanks

malc0mn’s picture

@19: this simply means that if the module you enabled does something like this:

    'module_name_publish_action' => array(
      'type' => 'module_name',
      'label' => t('Enable'),
    ),

in hook_action_info() you will see this error. Change it to something like this:

    'module_name_publish_action' => array(
      'type' => 'module_name',
      'label' => t('Enable'),
      'configurable' => FALSE,
    ),

to fix the problem and log an issue in the module's issue queue for the maintainer to fix it.

jjmackow’s picture

Along the same lines as #19 though, is there a way to determine what the offending module is?
In Drupal 7.18, I'm receiving this error at line 282, and when I look at the code within the 'actions_synchronize' function, its reasonable to see that the issue has to do with the 'configurable' key from the passed array.

But what would be the best way of trapping the call that is causing the error message.

Thanks.

k

DaPooch’s picture

While it's true that contrib modules should implement this properly, I still think it's a good idea to do the check if possible to avoid raising a notice. Of the 9 modules I have that implement hook_action_info() only 5 of them properly declare the 'configurable' value. Not a great attention to detail with the API I'll admit, but obviously it's a common mistake.

malc0mn’s picture

I would think that the default value for configurable would be FALSE. That is the most logical approach and the least confusing. It's a bit like hook_menu() and MENU_NORMAL_ITEM imho:

If the "type" element is omitted, MENU_NORMAL_ITEM is assumed.