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).
Files: 
CommentFileSizeAuthor
#11 drupal-actions-985814-11-D7.patch879 bytesmikeytown2
PASSED: [[SimpleTest]]: [MySQL] 38,641 pass(es).
[ View ]
#8 drupal-actions-985814-8-D7.patch859 bytesmikeytown2
PASSED: [[SimpleTest]]: [MySQL] 38,620 pass(es).
[ View ]
#6 drupal-actions-985814-6-D7.patch630 bytesmikeytown2
PASSED: [[SimpleTest]]: [MySQL] 38,630 pass(es).
[ View ]
#4 drupal-actions-985814-4-D6.patch666 bytesmikeytown2
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-actions-985814-4-D6.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#2 actions-985814-d6.patch658 bytesjoshuajabbour
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch actions-985814-d6_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#1 actions-985814.patch622 bytesjoshuajabbour
PASSED: [[SimpleTest]]: [MySQL] 28,951 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new622 bytes
PASSED: [[SimpleTest]]: [MySQL] 28,951 pass(es).
[ View ]

d7 patch

StatusFileSize
new658 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch actions-985814-d6_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

d6 backport

#2 works for 6.x.

StatusFileSize
new666 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-actions-985814-4-D6.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Updated #2 patch for git

Status:Needs review» Needs work

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

Status:Needs work» Needs review
StatusFileSize
new630 bytes
PASSED: [[SimpleTest]]: [MySQL] 38,630 pass(es).
[ View ]

Redo #1 for test bot.

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).

StatusFileSize
new859 bytes
PASSED: [[SimpleTest]]: [MySQL] 38,620 pass(es).
[ View ]

@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.

This time it works, thanks!

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.

Status:Needs work» Needs review
StatusFileSize
new879 bytes
PASSED: [[SimpleTest]]: [MySQL] 38,641 pass(es).
[ View ]

check to make sure an array was passed in.

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.

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).

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.

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.

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..

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

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

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

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

<?php
   
'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:

<?php
   
'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.

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

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.

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.